| 1 | /* Matrix_Categories.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2019 David Weenink, 2018 Paul Boersma |
| 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 | #include "Matrix_Categories.h"cxx . . $ `<file>/dwtools/Matrix_Categories.h`/ |
| 20 | #include "TableOfReal_extensions.h"cxx . . $ `<file>/dwtools/TableOfReal_extensions.h`/ |
| 21 | |
| 22 | autoTableOfRealcxx . . $ autoTableOfReal# Matrix_Categories_to_TableOfRealcxx . . $ Matrix_Categories_to_TableOfReal(391ccd9ed2ca437b). (Matrixcxx . . $ Matrix# me, Categoriescxx . . $ Categories# thee) { |
| 23 | try { |
| 24 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (thycxx . . $ `melder/melder.h:45:9`! size == mycxx . . $ `melder/melder.h:44:9`! ny, |
| 25 | U"Number of rows and number of categories should be equal."); |
| 26 | |
| 27 | autoTableOfRealcxx . . $ autoTableOfReal# him = TableOfReal_createcxx . . $ TableOfReal_create(e573ed3514e79d3). (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny., mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.); |
| 28 | TableOfReal_setSequentialColumnLabelscxx . . $ TableOfReal_setSequentialColumnLabels(8dc3139cdc86d712). (him.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0, 0, nullptr, 1, 1); |
| 29 | |
| 30 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; i ++) { |
| 31 | const SimpleStringcxx . . $ SimpleString# category = thycxx . . $ `melder/melder.h:45:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 32 | hiscxx . . $ `melder/melder.h:47:9`! rowLabelscxx . . $ structTableOfReal#rowLabels. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (category -> stringcxx . . $ structSimpleString#string..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 33 | } |
| 34 | |
| 35 | hiscxx . . $ `melder/melder.h:47:9`! datacxx . . $ structTableOfReal#data..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).(); |
| 36 | |
| 37 | return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 38 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 39 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"TableOfReal not created from Matrix & Categories."); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /* End of file Matrix_Categories.cpp */ |