Configuration.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef _Configuration_h_
  2. #define _Configuration_h_
  3. /* Configuration.h
  4. *
  5. * Copyright (C) 1992-2017 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. #include "Graphics.h"
  21. #include "TableOfReal.h"
  22. #include "Collection.h"
  23. #include "Configuration_def.h"
  24. #pragma mark - class Configuration
  25. autoConfiguration Configuration_create (integer numberOfPoints, integer numberOfDimensions);
  26. void Configuration_setMetric (Configuration me, integer metric);
  27. void Configuration_setDefaultWeights (Configuration me);
  28. /* All w[i] = 1 */
  29. void Configuration_setSqWeights (Configuration me, const double weight[]);
  30. /* All w[i] = sqrt (weight[i]) */
  31. void Configuration_randomize (Configuration me);
  32. /*
  33. new x[i][j] = randomUniform (-1,1)
  34. */
  35. void Configuration_normalize (Configuration me, double variance, bool choice);
  36. /*
  37. 1. centre columns
  38. 2.
  39. choice == !0 : each column
  40. == 0 : normalize matrix
  41. */
  42. void Configuration_rotate (Configuration me, integer dimension1, integer dimension2, double angle_degrees);
  43. /*
  44. Precondition:
  45. dimension1 != dimension2
  46. 1 <= dimension1, dimension2 <= my numberOfColumns
  47. */
  48. void Configuration_invertDimension (Configuration me, int dimension);
  49. /*
  50. Function:
  51. Invert one dimension.
  52. for (i=1; i <= my numberOfRows; i++)
  53. my data[i][dimension] = - my data[i][dimension];
  54. */
  55. autoConfiguration Configuration_congruenceRotation (Configuration me, Configuration thee,
  56. integer maximumNumberOfIterations, double tolerance);
  57. /*
  58. Rotate thee for maximum congruence. Algorithm:
  59. Henk Kiers & Patrick Groenen (1996), "A monotonically convergent algorithm for
  60. orthogonal congruence rotation", Psychometrika 61, 375-389.
  61. */
  62. autoConfiguration Configuration_varimax (Configuration me, bool normalizeRows, bool quartimax, integer maximumNumberOfIterations, double tolerance);
  63. /*
  64. Perform varimax rotation. Algorithm with extra security from:
  65. Jos Ten Berge (1995), "Suppressing permutations or rigid planar rotations:
  66. a remedy against nonoptimal varimax rotations", Psychometrika 60, 437-446.
  67. */
  68. void Configuration_rotateToPrincipalDirections (Configuration me);
  69. void Configuration_draw (Configuration me, Graphics g, int xCoordinate,
  70. int yCoordinate, double xmin, double xmax, double ymin, double ymax,
  71. int labelSize, bool useRowLabels, conststring32 label, bool garnish);
  72. void Configuration_drawConcentrationEllipses (Configuration me, Graphics g,
  73. double scale, bool confidence, conststring32 label, integer d1, integer d2, double xmin, double xmax,
  74. double ymin, double ymax, int fontSize, bool garnish);
  75. autoConfiguration TableOfReal_to_Configuration (TableOfReal me);
  76. autoConfiguration TableOfReal_to_Configuration_pca (TableOfReal me, integer numberOfDimensions);
  77. /*
  78. Precondition:
  79. numberOfDimensions > 0
  80. Function:
  81. principal component analysis
  82. Postcondition:
  83. (Configuration) numberOfColumns = MIN (my numberOfColumns, numberOfDimensions)
  84. */
  85. autoConfiguration Configuration_createLetterRExample (int choice);
  86. /*
  87. Create a two-dimensional configuartion from the letter R.
  88. choice = 1 : undistorted;
  89. choice = 2 : result of monotone fit on distorted (d^2 + 5 +32.5*z)
  90. */
  91. autoConfiguration Configuration_createCarrollWishExample ();
  92. #pragma mark - class ConfigurationList
  93. Collection_define (ConfigurationList, OrderedOf, Configuration) {
  94. };
  95. /* End of file Configuration.h */
  96. #endif