| 1 |
#ifndef _Configuration_h_ |
| 2 |
#define _Configuration_h_ |
| 3 |
/* Configuration.h |
| 4 |
* |
| 5 |
* Copyright (C) 1992-2017, 2023 David Weenink |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "Graphics.h" |
| 22 |
#include "TableOfReal.h" |
| 23 |
#include "Collection.h" |
| 24 |
|
| 25 |
#include "Configuration_def.h" |
| 26 |
|
| 27 |
|
| 28 |
#pragma mark - class Configuration |
| 29 |
|
| 30 |
autoConfiguration Configuration_create (integer numberOfPoints, integer numberOfDimensions); |
| 31 |
|
| 32 |
void Configuration_setMetric (Configuration me, integer metric); |
| 33 |
|
| 34 |
void Configuration_setDefaultWeights (Configuration me); |
| 35 |
/* All w [i] = 1 */ |
| 36 |
|
| 37 |
void Configuration_setSqWeights (Configuration me, const double weight []); |
| 38 |
/* All w [i] = sqrt (weight [i]) */ |
| 39 |
|
| 40 |
void Configuration_randomize (Configuration me); |
| 41 |
/* |
| 42 |
new x [i] [j] = randomUniform (-1,1) |
| 43 |
*/ |
| 44 |
|
| 45 |
void Configuration_normalize (Configuration me, double variance, bool choice); |
| 46 |
/* |
| 47 |
1. centre columns |
| 48 |
2. |
| 49 |
choice == !0 : each column |
| 50 |
== 0 : normalize matrix |
| 51 |
*/ |
| 52 |
|
| 53 |
void Configuration_rotate (Configuration me, integer dimension1, integer dimension2, double angle_degrees); |
| 54 |
/* |
| 55 |
Precondition: |
| 56 |
dimension1 != dimension2 |
| 57 |
1 <= dimension1, dimension2 <= my numberOfColumns |
| 58 |
*/ |
| 59 |
|
| 60 |
void Configuration_invertDimension (Configuration me, int dimension); |
| 61 |
/* |
| 62 |
Function: |
| 63 |
Invert one dimension. |
| 64 |
for (i=1; i <= my numberOfRows; i++) |
| 65 |
my data [i] [dimension] = - my data [i] [dimension]; |
| 66 |
*/ |
| 67 |
|
| 68 |
autoConfiguration Configuration_congruenceRotation (Configuration me, Configuration thee, |
| 69 |
integer maximumNumberOfIterations, double tolerance); |
| 70 |
/* |
| 71 |
Rotate thee for maximum congruence. Algorithm: |
| 72 |
Henk Kiers & Patrick Groenen (1996), "A monotonically convergent algorithm for |
| 73 |
orthogonal congruence rotation", Psychometrika 61, 375-389. |
| 74 |
*/ |
| 75 |
|
| 76 |
autoConfiguration Configuration_varimax (Configuration me, bool normalizeRows, bool quartimax, integer maximumNumberOfIterations, double tolerance); |
| 77 |
/* |
| 78 |
Perform varimax rotation. Algorithm with extra security from: |
| 79 |
Jos Ten Berge (1995), "Suppressing permutations or rigid planar rotations: |
| 80 |
a remedy against nonoptimal varimax rotations", Psychometrika 60, 437-446. |
| 81 |
*/ |
| 82 |
|
| 83 |
void Configuration_rotateToPrincipalDirections (Configuration me); |
| 84 |
|
| 85 |
void Configuration_draw (Configuration me, Graphics g, int xCoordinate, |
| 86 |
int yCoordinate, double xmin, double xmax, double ymin, double ymax, |
| 87 |
int labelSize, bool useRowLabels, conststring32 label, bool garnish); |
| 88 |
|
| 89 |
void Configuration_drawConcentrationEllipses (Configuration me, Graphics g, |
| 90 |
double scale, bool confidence, conststring32 label, integer d1, integer d2, double xmin, double xmax, |
| 91 |
double ymin, double ymax, double fontSize, bool garnish); |
| 92 |
|
| 93 |
autoConfiguration TableOfReal_to_Configuration (TableOfReal me); |
| 94 |
|
| 95 |
autoConfiguration TableOfReal_to_Configuration_pca (TableOfReal me, integer numberOfDimensions); |
| 96 |
/* |
| 97 |
Precondition: |
| 98 |
numberOfDimensions > 0 |
| 99 |
Function: |
| 100 |
principal component analysis |
| 101 |
Postcondition: |
| 102 |
(Configuration) numberOfColumns = MIN (my numberOfColumns, numberOfDimensions) |
| 103 |
*/ |
| 104 |
|
| 105 |
autoConfiguration Configuration_createLetterRExample (int choice); |
| 106 |
/* |
| 107 |
Create a two-dimensional configuration from the letter R. |
| 108 |
choice = 1 : undistorted; |
| 109 |
choice = 2 : result of monotone fit on distorted (d^2 + 5 +32.5*z) |
| 110 |
*/ |
| 111 |
|
| 112 |
autoConfiguration Configuration_createCarrollWishExample (); |
| 113 |
|
| 114 |
|
| 115 |
#pragma mark - class ConfigurationList |
| 116 |
|
| 117 |
Collection_define (ConfigurationList, OrderedOf, Configuration) { |
| 118 |
}; |
| 119 |
|
| 120 |
/* End of file Configuration.h */ |
| 121 |
#endif |