| 1 | /* Matrix_and_PointProcess.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2005,2011,2015-2018,2026 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 3 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. |
| 13 | * See the GNU 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_and_PointProcess.h"cxx . . $ `<file>/fon/Matrix_and_PointProcess.h`/ |
| 20 | |
| 21 | autoMatrixcxx . . $ autoMatrix# PointProcess_to_Matrixcxx . . $ PointProcess_to_Matrix(4f7150685fa4792c). (PointProcesscxx . . $ PointProcess# me) { |
| 22 | try { |
| 23 | if (mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt. == 0) |
| 24 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"No times in PointProcess."); |
| 25 | autoMatrixcxx . . $ autoMatrix# you = Matrix_createcxx . . $ Matrix_create(494a3ae9ff7e3b60). (1.0, double (mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt.), mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt., 1.0, 1.0, 1.0, 1.0, 1, 1.0, 1.0); |
| 26 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt.; i ++) |
| 27 | yourcxx . . $ `melder/melder.h:46:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i] = mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]; |
| 28 | return youcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 29 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 30 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Matrix."); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | autoPointProcesscxx . . $ autoPointProcess# Matrix_to_PointProcesscxx . . $ Matrix_to_PointProcess(18afc09187b58ec9). (Matrixcxx . . $ Matrix# me) { |
| 35 | try { |
| 36 | Melder_precxx . . $ `melder/melder_assert.h:40:10`! (mycxx . . $ `melder/melder.h:44:9`! nx > 0); |
| 37 | Melder_precxx . . $ `melder/melder_assert.h:40:10`! (mycxx . . $ `melder/melder.h:44:9`! ny > 0); |
| 38 | autoPointProcesscxx . . $ autoPointProcess# you = PointProcess_createcxx . . $ PointProcess_create(7a858f446a8dd7cc). (mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).1], mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).1] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.], mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.); |
| 39 | PointProcess_addPointscxx . . $ PointProcess_addPoints(6d4e3d986edb4e15). (you.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..getcxx . . $ automatrix#get(b2b81450b5bdda66).(). asvectorcxx . . $ matrix#asvector(e8d1da7fe68a6585).()); |
| 40 | yourcxx . . $ `melder/melder.h:46:9`! xmincxx . . $ structFunction#xmin. = yourcxx . . $ `melder/melder.h:46:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).1]; |
| 41 | yourcxx . . $ `melder/melder.h:46:9`! xmaxcxx . . $ structFunction#xmax. = yourcxx . . $ `melder/melder.h:46:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).yourcxx . . $ `melder/melder.h:46:9`! ntcxx . . $ structPointProcess#nt.]; |
| 42 | // TODO: problematic case: one point only, because then `your xmin == your xmax` |
| 43 | // TODO: problematic case: multiple identical times (responsibility of `PointProcess_addPoints`) |
| 44 | return youcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 45 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 46 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to PointProcess."); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /* End of file Matrix_and_PointProcess.cpp */ |