| 1 | /* Configuration.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2021 David Weenink |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | djmw 20010920 +Configuration_getDilationFactor |
| 21 | djmw 20020315 GPL header |
| 22 | djmw 20030513 applied change in numeric label generation |
| 23 | djmw 20030801 Configuration_drawConcentrationEllipses extra argument |
| 24 | djmw 20040303 Moved containsPrintableCharacter to NUM2.c |
| 25 | djmw 20041026 Removed non-used code. |
| 26 | djmw 20050314 Configuration_draw crashed when rowlabel==nullptr |
| 27 | djmw 20061212 Changed info to Melder_writeLine<x> format. |
| 28 | djmw 20071009 wchar |
| 29 | djmw 20071012 Added: o_CAN_WRITE_AS_ENCODING.h |
| 30 | djmw 20100302 Extra test in Configuration_rotate |
| 31 | djmw 20110304 Thing_new |
| 32 | */ |
| 33 | |
| 34 | #include "SVD.h"cxx . . $ `<file>/dwsys/SVD.h`/ |
| 35 | #include "PCA.h"cxx . . $ `<file>/dwtools/PCA.h`/ |
| 36 | #include "Configuration.h"cxx . . $ `<file>/dwtools/Configuration.h`/ |
| 37 | #include "Configuration_AffineTransform.h"cxx . . $ `<file>/dwtools/Configuration_AffineTransform.h`/ |
| 38 | #include "TableOfReal_extensions.h"cxx . . $ `<file>/dwtools/TableOfReal_extensions.h`/ |
| 39 | #include "SSCP.h"cxx . . $ `<file>/dwtools/SSCP.h`/ |
| 40 | |
| 41 | #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/ |
| 42 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 43 | #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/ |
| 44 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 45 | #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/ |
| 46 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 47 | #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/ |
| 48 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 49 | #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/ |
| 50 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 51 | #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/ |
| 52 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 53 | #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/ |
| 54 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 55 | #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/ |
| 56 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 57 | #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/ |
| 58 | #include "Configuration_def.h"cxx . . $ `<file>/dwtools/Configuration_def.h`/ |
| 59 | |
| 60 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (Configuration, TableOfReal, 0); |
| 61 | |
| 62 | void structConfiguration :: v1_info () { |
| 63 | structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). (); |
| 64 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Number of points: ", numberOfRowscxx . . $ structTableOfReal#numberOfRows.); |
| 65 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Number of dimensions: ", numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.); |
| 66 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Metric: ", metric); |
| 67 | } |
| 68 | |
| 69 | autoConfiguration Configuration_createcxx . . $ Configuration_create(312218706738bb63). (integercxx . . $ integer# numberOfPoints, integercxx . . $ integer# numberOfDimensions) { |
| 70 | try { |
| 71 | autoConfiguration me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Configuration); |
| 72 | TableOfReal_initcxx . . $ TableOfReal_init(cfadf70b559ed315). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), numberOfPoints, numberOfDimensions); |
| 73 | mycxx . . $ `melder/melder.h:44:9`! w =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (numberOfDimensions); |
| 74 | TableOfReal_setSequentialRowLabelscxx . . $ TableOfReal_setSequentialRowLabels(8dc3139cdc86d712). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0, 0, nullptr, 1, 1); |
| 75 | TableOfReal_setSequentialColumnLabelscxx . . $ TableOfReal_setSequentialColumnLabels(8dc3139cdc86d712). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0, 0, U"dimension ", 1, 1); |
| 76 | |
| 77 | mycxx . . $ `melder/melder.h:44:9`! metric = 2; |
| 78 | Configuration_setDefaultWeightscxx . . $ Configuration_setDefaultWeights(4cfce9233baadf27). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 79 | Configuration_randomizecxx . . $ Configuration_randomize(4cfce9233baadf27). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 80 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 81 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 82 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Configuration not created."); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | void Configuration_setMetriccxx . . $ Configuration_setMetric(84077623e938518a). (Configuration me, integercxx . . $ integer# metric) { |
| 87 | mycxx . . $ `melder/melder.h:44:9`! metric = metric; |
| 88 | } |
| 89 | |
| 90 | void Configuration_setDefaultWeightscxx . . $ Configuration_setDefaultWeights(4cfce9233baadf27). (Configuration me) { |
| 91 | mycxx . . $ `melder/melder.h:44:9`! w.allcxx . . $ autovector#all(a26726dad87555bb).() <<=cxx . . $ `operator<<=`(c555d170d72ff256). 1.0; |
| 92 | } |
| 93 | |
| 94 | void Configuration_setSqWeightscxx . . $ Configuration_setSqWeights(e05afe2ce22bbe6e). (Configuration me, const double weight []) { |
| 95 | for (integercxx . . $ integer# icol = 1; icol <= mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.; icol ++) { |
| 96 | mycxx . . $ `melder/melder.h:44:9`! w [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icol] = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (weight [icol]); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | void Configuration_normalizecxx . . $ Configuration_normalize(d5cde0c5e772706a). (Configuration me, double sumsq, bool columns) { |
| 101 | TableOfReal_centreColumnscxx . . $ TableOfReal_centreColumns(683412d750813a40). (me); |
| 102 | if (columns) { |
| 103 | sumsq = ( sumsq <= 0.0 ? 1.0 : sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (sumsq) ); |
| 104 | MATnormalizeColumns_inplacecxx . . $ MATnormalizeColumns_inplace(2fdf026ca2b4c21). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), 2.0, sumsq); |
| 105 | } else { |
| 106 | if (sumsq <= 0.0) |
| 107 | sumsq = mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; |
| 108 | MATnormalize_inplacecxx . . $ MATnormalize_inplace(2fdf026ca2b4c21). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), 2.0, sumsq); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | void Configuration_randomizecxx . . $ Configuration_randomize(4cfce9233baadf27). (Configuration me) { |
| 113 | for (integercxx . . $ integer# irow = 1; irow <= mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; irow ++) |
| 114 | for (integercxx . . $ integer# icol = 1; icol <= mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.; icol ++) |
| 115 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (-1.0, 1.0); |
| 116 | } |
| 117 | |
| 118 | void Configuration_rotatecxx . . $ Configuration_rotate(c15aa9fe2e836713). (Configuration me, integercxx . . $ integer# dimension1, integercxx . . $ integer# dimension2, double angle_degrees) { |
| 119 | if (dimension1 == dimension2 || angle_degrees == 0) |
| 120 | return; |
| 121 | if (dimension1 > dimension2) |
| 122 | stdcxx . . $ std/::swapcxx . . $ std/swap(c75b8fd57d7c2e06). (dimension1, dimension2); |
| 123 | if (dimension1 < 1 || dimension2 > mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.) |
| 124 | return; |
| 125 | const double phi = NUMpicxx . . $ NUMpi. * (2.0 - angle_degrees / 180.0); |
| 126 | const double cosa = coscxx . . $ cos(fee4f1d22bc8e617). (phi), sina = sincxx . . $ sin(fee4f1d22bc8e617). (phi); |
| 127 | for (integercxx . . $ integer# irow = 1; irow <= mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; irow ++) { |
| 128 | const double x1 = mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension1]; |
| 129 | const double x2 = mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension2]; |
| 130 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension1] = cosa * x1 + sina * x2; |
| 131 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension2] = - sina * x1 + cosa * x2; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void Configuration_invertDimensioncxx . . $ Configuration_invertDimension(3167ebd879575aa7). (Configuration me, int dimension) { |
| 136 | if (dimension < 1 || dimension > mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.) |
| 137 | return; |
| 138 | for (integercxx . . $ integer# irow = 1; irow <= mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; irow ++) |
| 139 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension] = - mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).dimension]; |
| 140 | } |
| 141 | |
| 142 | static double NUMsquaredVariancecxx . . $ NUMsquaredVariance(ced4686f5c31afb3). (MATcxx . . $ MAT# a, bool rawPowers) { |
| 143 | longdoublecxx . . $ longdouble# v4 = 0.0; |
| 144 | for (integercxx . . $ integer# icol = 1; icol <= a.ncolcxx . . $ matrix#ncol.; icol ++) { |
| 145 | longdoublecxx . . $ longdouble# sum4 = 0.0, mean = 0.0; |
| 146 | for (integercxx . . $ integer# irow = 1; irow <= a.nrowcxx . . $ matrix#nrow.; irow ++) { |
| 147 | const double sq = a [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] * a [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol]; |
| 148 | sum4 += sq * sq; |
| 149 | mean += sq; |
| 150 | } |
| 151 | v4 += sum4; |
| 152 | if (! rawPowers) { |
| 153 | v4 -= mean * mean / a.nrowcxx . . $ matrix#nrow.; |
| 154 | } |
| 155 | } |
| 156 | return (double) v4; |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | Varimax rotation, implementation according to: |
| 161 | Jos Ten Berge (1995), "Suppressing permutations or rigid |
| 162 | planar rotations: a remedy against nonoptimal varimax rotations", |
| 163 | Psychometrika 60, 437-446. |
| 164 | */ |
| 165 | static void NUMvarimaxcxx . . $ NUMvarimax(db46143052e87af7). (MATcxx . . $ MAT# xm, MATcxx . . $ MAT# ym, bool normalizeRows, bool quartimax, integercxx . . $ integer# maximumNumberOfIterations, double tolerance) { |
| 166 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (xm.ncol == ym.ncol && xm.nrow == ym.nrow); |
| 167 | |
| 168 | ymcxx . . $ matrixview#matrixview(eed9513d24570b3d). <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). xmcxx . . $ constmatrixview#constmatrixview(eed9513d24570b3d).; |
| 169 | |
| 170 | if (xm.ncolcxx . . $ matrix#ncol. == 1) |
| 171 | return; |
| 172 | if (xm.ncolcxx . . $ matrix#ncol. == 2) |
| 173 | maximumNumberOfIterations = 1; |
| 174 | |
| 175 | autoVECcxx . . $ autoVEC# u = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (xm.nrowcxx . . $ matrix#nrow.); |
| 176 | autoVECcxx . . $ autoVEC# v = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (xm.nrowcxx . . $ matrix#nrow.); |
| 177 | autoVECcxx . . $ autoVEC# norm = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (xm.nrowcxx . . $ matrix#nrow.); |
| 178 | /* |
| 179 | Normalize sum of squares of each row to one. |
| 180 | After rotation we have to rescale. |
| 181 | */ |
| 182 | if (normalizeRows) |
| 183 | for (long irow = 1; irow <= ym.nrowcxx . . $ matrix#nrow.; irow ++) { |
| 184 | norm [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] = NUMnormcxx . . $ NUMnorm(885a97927582bd48). (ymcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..rowcxx . . $ matrix#row(2d545b3cb3f8e666). (irow), 2.0); |
| 185 | ymcxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..rowcxx . . $ matrix#row(2d545b3cb3f8e666). (irow) /=cxx . . $ `operator/=`(c555d170d72ff256). norm [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow]; |
| 186 | } |
| 187 | /* |
| 188 | Initial squared "variance". |
| 189 | */ |
| 190 | double varianceSq = NUMsquaredVariancecxx . . $ NUMsquaredVariance(ced4686f5c31afb3). (ym, quartimax); |
| 191 | |
| 192 | if (varianceSq == 0.0) |
| 193 | return; |
| 194 | /* |
| 195 | Treat columns pairwise. |
| 196 | */ |
| 197 | double varianceSq_old; |
| 198 | integercxx . . $ integer# numberOfIterations = 0; |
| 199 | do { |
| 200 | for (integercxx . . $ integer# icol = 1; icol <= xm.ncolcxx . . $ matrix#ncol.; icol ++) { |
| 201 | for (integercxx . . $ integer# jcol = icol + 1; jcol <= xm.ncolcxx . . $ matrix#ncol.; jcol ++) { |
| 202 | for (integercxx . . $ integer# irow = 1; irow <= xm.nrowcxx . . $ matrix#nrow.; irow ++) { |
| 203 | const double x = ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol]; |
| 204 | const double y = ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).jcol]; |
| 205 | u [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] = x * x - y * y; |
| 206 | v [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] = 2.0 * x * y; |
| 207 | } |
| 208 | |
| 209 | if (! quartimax && xm.nrowcxx . . $ matrix#nrow. != 1) { |
| 210 | centre_VEC_inoutcxx . . $ centre_VEC_inout(b915798f9bafc8a). (ucxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 211 | centre_VEC_inoutcxx . . $ centre_VEC_inout(b915798f9bafc8a). (vcxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 212 | } |
| 213 | |
| 214 | const double a = 2.0 * NUMinnercxx . . $ NUMinner(5e5adb47f563a3e3). (ucxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).(), vcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 215 | const double b = NUMinnercxx . . $ NUMinner(5e5adb47f563a3e3). (ucxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).(), ucxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()) - NUMinnercxx . . $ NUMinner(5e5adb47f563a3e3). (vcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).(), vcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 216 | |
| 217 | const double c = hypotcxx . . $ hypot(b71928d39fde4295). (a, b); |
| 218 | double vc = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). ((c + b) / (2.0 * c)); // Eq. (1) |
| 219 | if (a > 0.0) |
| 220 | vc = -vc; |
| 221 | /* |
| 222 | Get the rotation matrix T |
| 223 | */ |
| 224 | const double cost = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (0.5 + 0.5 * vc); |
| 225 | const double sint = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (0.5 - 0.5 * vc); |
| 226 | double t11 = cost; |
| 227 | double t12 = sint; |
| 228 | double t21 = -sint; |
| 229 | double t22 = cost; |
| 230 | /* |
| 231 | Prevent permutations: when v < 0, i.e., a > 0, swap columns of T:/ |
| 232 | */ |
| 233 | if (vc < 0.0) { |
| 234 | t11 = sint; |
| 235 | t12 = t21 = cost; |
| 236 | t22 = -sint; |
| 237 | } |
| 238 | /* |
| 239 | Rotate in the plane spanned by icol and jcol. |
| 240 | */ |
| 241 | for (integercxx . . $ integer# irow = 1; irow <= xm.nrowcxx . . $ matrix#nrow.; irow ++) { |
| 242 | const double x = ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol], y = ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).jcol]; |
| 243 | ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).icol] = x * t11 + y * t21; |
| 244 | ym [cxx . . $ matrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).jcol] = x * t12 + y * t22; |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | numberOfIterations++; |
| 250 | varianceSq_old = varianceSq; |
| 251 | varianceSq = NUMsquaredVariancecxx . . $ NUMsquaredVariance(ced4686f5c31afb3). (ym, quartimax); |
| 252 | |
| 253 | } while (fabscxx . . $ fabs(fee4f1d22bc8e617). (varianceSq_old - varianceSq) > stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a). (tolerance * varianceSq_old, NUMepscxx . . $ `dwsys/NUM2.h:36:9`!) && |
| 254 | numberOfIterations < maximumNumberOfIterations); |
| 255 | |
| 256 | if (normalizeRows) |
| 257 | for (integercxx . . $ integer# irow = 1; irow <= xm.nrowcxx . . $ matrix#nrow.; irow ++) |
| 258 | ymcxx . . $ vectorview#vectorview(eac9d6ec4c4bfecd)..rowcxx . . $ matrix#row(2d545b3cb3f8e666). (irow) *=cxx . . $ `operator*=`(c555d170d72ff256). norm [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow]; |
| 259 | } |
| 260 | |
| 261 | autoConfiguration Configuration_varimaxcxx . . $ Configuration_varimax(48482054105aedc9). (Configuration me, bool normalizeRows, bool quartimax, integercxx . . $ integer# maximumNumberOfIterations, double tolerance) { |
| 262 | try { |
| 263 | autoConfiguration thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me); |
| 264 | NUMvarimaxcxx . . $ NUMvarimax(db46143052e87af7). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), thycxx . . $ `melder/melder.h:45:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), normalizeRows, quartimax, maximumNumberOfIterations, tolerance); |
| 265 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 266 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 267 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": varimax rotation not performed."); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | autoConfiguration Configuration_congruenceRotationcxx . . $ Configuration_congruenceRotation(faa0e86191a02792). (Configuration me, Configuration thee, integercxx . . $ integer# maximumNumberOfIterations, double tolerance) { |
| 272 | try { |
| 273 | autoAffineTransformcxx . . $ autoAffineTransform# at = Configurations_to_AffineTransform_congruencecxx . . $ Configurations_to_AffineTransform_congruence(edc59d37ab87d18b). (me, thee, maximumNumberOfIterations, tolerance); |
| 274 | autoConfiguration him = Configuration_AffineTransform_to_Configurationcxx . . $ Configuration_AffineTransform_to_Configuration(b84d8ab835655fdd). (me, at.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 275 | return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 276 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 277 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": congruence rotation not performed."); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | void Configuration_rotateToPrincipalDirectionscxx . . $ Configuration_rotateToPrincipalDirections(4cfce9233baadf27). (Configuration me) { |
| 282 | try { |
| 283 | autoMATcxx . . $ autoMAT# pc = MAT_asPrincipalComponentscxx . . $ MAT_asPrincipalComponents(4987e7f027662247). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..ncolcxx . . $ automatrix#ncol.); |
| 284 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). pccxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58)..allcxx . . $ automatrix#all(2114117ba8ed4224).(); |
| 285 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 286 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not rotated to principal directions."); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | void Configuration_drawcxx . . $ Configuration_draw(4ca13aefe3d0ec39). (Configuration me, Graphicscxx . . $ Graphics# g, int horizontalDimension, int verticalDimension, |
| 291 | double xmin, double xmax, double ymin, double ymax, int labelSize, bool useRowLabels, conststring32cxx . . $ conststring32# label, bool garnish) |
| 292 | { |
| 293 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (horizontalDimension > 0, |
| 294 | U"The horizontal dimension should be positive, not ", horizontalDimension, U"."); |
| 295 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (horizontalDimension <= mycxx . . $ `melder/melder.h:44:9`! numberOfColumns, |
| 296 | U"The horizontal dimension should not exceed the number of dimensions (", mycxx . . $ `melder/melder.h:44:9`! numberOfColumns, |
| 297 | U"), but is in fact ", horizontalDimension, U"." |
| 298 | ); |
| 299 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (verticalDimension > 0, |
| 300 | U"The vertical dimension should be positive, not ", verticalDimension, U"."); |
| 301 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (verticalDimension <= mycxx . . $ `melder/melder.h:44:9`! numberOfColumns, |
| 302 | U"The vertical dimension should not exceed the number of dimensions (", mycxx . . $ `melder/melder.h:44:9`! numberOfColumns, |
| 303 | U"), but is in fact ", verticalDimension, U"." |
| 304 | ); |
| 305 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (horizontalDimension != verticalDimension, |
| 306 | U"The horizontal dimension and the vertical dimension should be different, but are in fact ", |
| 307 | horizontalDimension, U" and ", verticalDimension, U"." |
| 308 | ); |
| 309 | const double fontSize = Graphics_inqFontSizecxx . . $ Graphics_inqFontSize(f906975acce41a59). (g); |
| 310 | int noLabel = 0; |
| 311 | if (labelSize == 0) |
| 312 | labelSize = fontSize; |
| 313 | autoVECcxx . . $ autoVEC# x = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.); |
| 314 | autoVECcxx . . $ autoVEC# y = raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.); |
| 315 | for (integercxx . . $ integer# irow = 1; irow <= mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; irow ++) { |
| 316 | x [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] = mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).horizontalDimension] * mycxx . . $ `melder/melder.h:44:9`! w [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).horizontalDimension]; |
| 317 | y [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] = mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).verticalDimension] * mycxx . . $ `melder/melder.h:44:9`! w [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).verticalDimension]; |
| 318 | } |
| 319 | if (xmax <= xmin) { |
| 320 | xmin = NUMmin_ucxx . . $ NUMmin_u(4bb9c3e3a8dd5442). (xcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 321 | xmax = NUMmax_ucxx . . $ NUMmax_u(4bb9c3e3a8dd5442). (xcxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 322 | } |
| 323 | if (xmax <= xmin) { |
| 324 | xmax += 1.0; |
| 325 | xmin -= 1.0; |
| 326 | } |
| 327 | if (ymax <= ymin) { |
| 328 | ymin = NUMmin_ucxx . . $ NUMmin_u(4bb9c3e3a8dd5442). (ycxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 329 | ymax = NUMmax_ucxx . . $ NUMmax_u(4bb9c3e3a8dd5442). (ycxx . . $ constvectorview#constvectorview(eac9d6ec4c4bfecd)..getcxx . . $ autovector#get(e8d1da7fe68a6585).()); |
| 330 | } |
| 331 | if (ymax <= ymin) { |
| 332 | ymax += 1.0; |
| 333 | ymin -= 1.0; |
| 334 | } |
| 335 | if (isundefcxx . . $ isundef(f8197d536af80c96). (xmin) || isundefcxx . . $ isundef(f8197d536af80c96). (xmax) || isundefcxx . . $ isundef(f8197d536af80c96). (ymin) || isundefcxx . . $ isundef(f8197d536af80c96). (ymax)) |
| 336 | return; |
| 337 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, xmin, xmax, ymin, ymax); |
| 338 | Graphics_setInnercxx . . $ Graphics_setInner(2d838ed765120c5d). (g); |
| 339 | Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!); |
| 340 | Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, labelSize); |
| 341 | for (integercxx . . $ integer# irow = 1; irow <= mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows.; irow ++) { |
| 342 | if (x [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] >= xmin && x [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] <= xmax && y [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] >= ymin && y [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow] <= ymax) { |
| 343 | const conststring32cxx . . $ conststring32# plotLabel = ( useRowLabels ? mycxx . . $ `melder/melder.h:44:9`! rowLabelscxx . . $ structTableOfReal#rowLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).irow].getcxx . . $ _autostring#get(5a2a78a048fb49a8).() : label ); |
| 344 | if (Melder_findInkcxx . . $ Melder_findInk(efea2b2856d283a0). (plotLabel)) { |
| 345 | Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (g, x [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow], y [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).irow], plotLabel); |
| 346 | } else { |
| 347 | noLabel ++; |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | Graphics_setFontSizecxx . . $ Graphics_setFontSize(2514a1c07b6be5e2). (g, fontSize); |
| 352 | Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (g, Graphics_LEFTcxx . . $ `sys/Graphics.h:249:9`!, Graphics_BOTTOMcxx . . $ `sys/Graphics.h:252:9`!); |
| 353 | Graphics_unsetInnercxx . . $ Graphics_unsetInner(2d838ed765120c5d). (g); |
| 354 | if (garnish) { |
| 355 | Graphics_drawInnerBoxcxx . . $ Graphics_drawInnerBox(2d838ed765120c5d). (g); |
| 356 | Graphics_marksBottomcxx . . $ Graphics_marksBottom(c3a11a8a55b243ff). (g, 2, true, true, false); |
| 357 | if (mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns. > 1) { |
| 358 | Graphics_marksLeftcxx . . $ Graphics_marksLeft(c3a11a8a55b243ff). (g, 2, true, true, false); |
| 359 | if (mycxx . . $ `melder/melder.h:44:9`! columnLabelscxx . . $ structTableOfReal#columnLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).horizontalDimension]) |
| 360 | Graphics_textBottomcxx . . $ Graphics_textBottom(48cf1f690ec61203). (g, true, mycxx . . $ `melder/melder.h:44:9`! columnLabelscxx . . $ structTableOfReal#columnLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).horizontalDimension].getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 361 | if (mycxx . . $ `melder/melder.h:44:9`! columnLabelscxx . . $ structTableOfReal#columnLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).verticalDimension]) |
| 362 | Graphics_textLeftcxx . . $ Graphics_textLeft(48cf1f690ec61203). (g, true, mycxx . . $ `melder/melder.h:44:9`! columnLabelscxx . . $ structTableOfReal#columnLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).verticalDimension].getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 363 | } |
| 364 | } |
| 365 | if (noLabel > 0) { |
| 366 | Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"Configuration: Draw: ", noLabel, U" out of ", mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows., |
| 367 | U" labels are not visible, because they are empty or they contain only spaces and/or other non-printable characters."); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | void Configuration_drawConcentrationEllipsescxx . . $ Configuration_drawConcentrationEllipses(9272a0e585d0824d). (Configuration me, Graphicscxx . . $ Graphics# g, double scale, bool confidence, conststring32cxx . . $ conststring32# label, |
| 372 | integercxx . . $ integer# d1, integercxx . . $ integer# d2, double xmin, double xmax, double ymin, double ymax, double fontSize, bool garnish) |
| 373 | { |
| 374 | autoSSCPListcxx . . $ autoSSCPList# sscps = TableOfReal_to_SSCPList_byLabelcxx . . $ TableOfReal_to_SSCPList_byLabel(2e5f452c6e02ade1). (me); |
| 375 | SSCPList_drawConcentrationEllipsescxx . . $ SSCPList_drawConcentrationEllipses(fd6755b3615ec33c). (sscps.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), g, scale, confidence, label, d1, d2, xmin, xmax, ymin, ymax, fontSize, garnish); |
| 376 | } |
| 377 | |
| 378 | autoConfiguration TableOfReal_to_Configurationcxx . . $ TableOfReal_to_Configuration(84cdc8d9f2472352). (TableOfRealcxx . . $ TableOfReal# me) { |
| 379 | try { |
| 380 | autoConfiguration thee = Configuration_createcxx . . $ Configuration_create(312218706738bb63). (mycxx . . $ `melder/melder.h:44:9`! numberOfRowscxx . . $ structTableOfReal#numberOfRows., mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.); |
| 381 | thycxx . . $ `melder/melder.h:45:9`! datacxx . . $ structTableOfReal#data..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data..getcxx . . $ automatrix#get(b2b81450b5bdda66).(); |
| 382 | TableOfReal_copyLabelscxx . . $ TableOfReal_copyLabels(4a8870dfd6c30d44). (me, thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1, 1); |
| 383 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 384 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 385 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted."); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | autoConfiguration TableOfReal_to_Configuration_pcacxx . . $ TableOfReal_to_Configuration_pca(d3dcf14d2c627b2c). (TableOfRealcxx . . $ TableOfReal# me, integercxx . . $ integer# numberOfDimensions) { |
| 390 | try { |
| 391 | if (numberOfDimensions < 1 || numberOfDimensions > mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.) |
| 392 | numberOfDimensions = mycxx . . $ `melder/melder.h:44:9`! numberOfColumnscxx . . $ structTableOfReal#numberOfColumns.; |
| 393 | autoPCAcxx . . $ autoPCA# pca = TableOfReal_to_PCA_byRowscxx . . $ TableOfReal_to_PCA_byRows(98e819603b195975). (me); |
| 394 | autoConfiguration thee = PCA_TableOfReal_to_Configurationcxx . . $ PCA_TableOfReal_to_Configuration(e6b9f4519f587579). (pca.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), me, numberOfDimensions); |
| 395 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 396 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 397 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": pca not performed."); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | /********************** Examples *********************************************/ |
| 402 | |
| 403 | /* |
| 404 | 20210614: Configuration_createLetterRExample. Revert to version without initialisation lists because |
| 405 | that version is buggy when compiled with gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 |
| 406 | It turn out that x1 and y2 will contain the same values as x2 and y2. |
| 407 | */ |
| 408 | autoConfiguration Configuration_createLetterRExamplecxx . . $ Configuration_createLetterRExample(edb1c2a8de44a665). (int choice) { |
| 409 | const double x1 [33] = { 0, |
| 410 | -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, |
| 411 | -5, -4, -3, -2, -1, 0, 1, 2.25, 3, 3, |
| 412 | 2.25, 1, 0, -1, -2, -3, -4, -1, 0, 1, 2, 3 }; |
| 413 | const double y1 [33] = { 0, |
| 414 | -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, |
| 415 | 4, 4, 4, 4, 4, 4, 4, 3.5, 2, 1, |
| 416 | -0.5, -1, -1, -1, -1, -1, -1, -2, -3, -4, -5, -6 }; |
| 417 | const double x2 [33] = {0, 0.94756043346272423, 0.73504466902509913, |
| 418 | 0.4528453515175927, 0.46311499024105723, 0.30345454816993439, |
| 419 | 0.075184942115601547, -0.090010071904764719, -0.19630977381424003, |
| 420 | -0.36341509807865086, -0.54216996409132612, -0.68704678013309872, |
| 421 | -0.67370169194623086, -0.69336494336440502, -0.67809065144478664, |
| 422 | -0.61382610572366281, -0.68656530656078996, -0.57704879646736551, |
| 423 | -0.63417502349009069, -0.37153350651419026, -0.091809666009009777, |
| 424 | 0.054833807442559397, 0.1445593164362155, 0.055587230806920782, |
| 425 | 0.18201798315035453, 0.048445620192953162, 0.081595930742961439, |
| 426 | 0.20063623749033621, 0.28546520751183313, 0.39384438699721991, |
| 427 | 0.62832258520372286, 0.78548335015622228, 1.0610707888793069 }; |
| 428 | const double y2 [33] = {0, 0.49630791172076621, 0.53320347382055022, |
| 429 | 0.62384637225470441, 0.47592708487655661, 0.50364353255684202, |
| 430 | 0.55311720162084443, 0.55118713773007066, 0.50007736370068601, |
| 431 | 0.40432332354648709, 0.49817059660482677, 0.49803436631629411, |
| 432 | 0.33213829258059019, 0.14585700576425648, -0.022110500334692869, |
| 433 | -0.1752555003289698, -0.29448744336706828, -0.45639468287493545, |
| 434 | -0.59177815505008013, -0.74980550818568981, -0.78095916436791279, |
| 435 | -0.64447562732895125, -0.49526830813007033, -0.22443396573313243, |
| 436 | -0.066378148077667398, -0.03498490725857361, 0.16196028200653381, |
| 437 | 0.30633527000982519, -0.14894460651161745, -0.30808798640907431, |
| 438 | -0.35920781945385832, -0.62766325578928184, -0.60389363590825562 }; |
| 439 | try { |
| 440 | autoConfiguration me = Configuration_createcxx . . $ Configuration_create(312218706738bb63). (32, 2); |
| 441 | Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ( choice == 2 ? U"R_fit" : U"R" )); |
| 442 | for (integercxx . . $ integer# irow = 1; irow <= 32; irow ++) { |
| 443 | char32cxx . . $ char32# s [20]; |
| 444 | Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (s, 20, irow); |
| 445 | TableOfReal_setRowLabelcxx . . $ TableOfReal_setRowLabel(7bba53c4f5b398fa). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), irow, s); |
| 446 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = ( choice == 2 ? x2 [irow] : x1 [irow] ); |
| 447 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).irow] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).2] = ( choice == 2 ? y2 [irow] : y1 [irow] ); |
| 448 | } |
| 449 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 450 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 451 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Letter R Configuration not created."); |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | autoConfiguration Configuration_createCarrollWishExamplecxx . . $ Configuration_createCarrollWishExample(c895aeeeb43362cf). () { |
| 456 | const double x [10] = {0, -1.0, 0.0, 1.0, -1.0, 0.0, 1.0, -1.0, 0.0, 1.0 }; |
| 457 | const double y [10] = {0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0 }; |
| 458 | char32cxx . . $ char32# const *label [] = { U"", U"A", U"B", U"C", U"D", U"E", U"F", U"G", U"H", U"I"}; |
| 459 | try { |
| 460 | constexpr integercxx . . $ integer# nObjects = 9; |
| 461 | autoConfiguration me = Configuration_createcxx . . $ Configuration_create(312218706738bb63). (nObjects, 2); |
| 462 | for (integercxx . . $ integer# i = 1; i <= nObjects; i ++) { |
| 463 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).i] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1] = x [i]; |
| 464 | mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structTableOfReal#data. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).i] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).2] = y [i]; |
| 465 | TableOfReal_setRowLabelcxx . . $ TableOfReal_setRowLabel(7bba53c4f5b398fa). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), i, label [i]); |
| 466 | } |
| 467 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 468 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 469 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Carroll Wish Configuration not created."); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | /************ CONFIGURATIONS **************************************/ |
| 474 | |
| 475 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ConfigurationList, TableOfRealList, 0); |
| 476 | |
| 477 | /* End of file Configuration.cpp */ |