| 1 | /* ActivationList.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2018 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 | #include "ActivationList.h"cxx . . $ `<file>/dwtools/ActivationList.h`/ |
| 20 | |
| 21 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ActivationList, Matrix, 2); |
| 22 | |
| 23 | int _ActivationList_checkElementscxx . . $ _ActivationList_checkElements(180fba31cef68d2). (ActivationListcxx . . $ ActivationList# me) { |
| 24 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny.; i ++) { |
| 25 | for (integercxx . . $ integer# j = 1; j <= mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.; j ++) { |
| 26 | if (mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).i] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).j] < 0.0 || mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).i] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).j] > 1.0) { |
| 27 | return 0; |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | return 1; |
| 32 | } |
| 33 | |
| 34 | void ActivationList_initcxx . . $ ActivationList_init(ff95681464139f1e). (ActivationListcxx . . $ ActivationList# me, integercxx . . $ integer# ny, integercxx . . $ integer# nx) { |
| 35 | Matrix_initcxx . . $ Matrix_init(9dd6c49f9830a091). (me, 1.0, nx, nx, 1.0, 1.0, 1.0, ny, ny, 1.0, 1.0); |
| 36 | } |
| 37 | |
| 38 | autoActivationListcxx . . $ autoActivationList# ActivationList_createcxx . . $ ActivationList_create(b83e53fc6a9ddd8f). (integercxx . . $ integer# ny, integercxx . . $ integer# nx) { |
| 39 | try { |
| 40 | autoActivationListcxx . . $ autoActivationList# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (ActivationList); |
| 41 | ActivationList_initcxx . . $ ActivationList_init(ff95681464139f1e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ny, nx); |
| 42 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 43 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 44 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Activation not created."); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | autoActivationListcxx . . $ autoActivationList# Matrix_to_ActivationListcxx . . $ Matrix_to_ActivationList(c269a9fcc9594b9d). (Matrixcxx . . $ Matrix# me) { |
| 49 | try { |
| 50 | autoActivationListcxx . . $ autoActivationList# thee = ActivationList_createcxx . . $ ActivationList_create(b83e53fc6a9ddd8f). (mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny., mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx.); |
| 51 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..getcxx . . $ automatrix#get(b2b81450b5bdda66).(); |
| 52 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 53 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 54 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to ActivationList."); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | autoMatrixcxx . . $ autoMatrix# ActivationList_to_Matrixcxx . . $ ActivationList_to_Matrix(f0ee04291014203f). (ActivationListcxx . . $ ActivationList# me) { |
| 59 | try { |
| 60 | autoMatrixcxx . . $ autoMatrix# thee = Matrix_createcxx . . $ Matrix_create(494a3ae9ff7e3b60). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., mycxx . . $ `melder/melder.h:44:9`! nxcxx . . $ structSampled#nx., mycxx . . $ `melder/melder.h:44:9`! dxcxx . . $ structSampled#dx., mycxx . . $ `melder/melder.h:44:9`! x1cxx . . $ structSampled#x1., mycxx . . $ `melder/melder.h:44:9`! ymincxx . . $ structSampledXY#ymin., mycxx . . $ `melder/melder.h:44:9`! ymaxcxx . . $ structSampledXY#ymax., mycxx . . $ `melder/melder.h:44:9`! nycxx . . $ structSampledXY#ny., mycxx . . $ `melder/melder.h:44:9`! dycxx . . $ structSampledXY#dy., mycxx . . $ `melder/melder.h:44:9`! y1cxx . . $ structSampledXY#y1.); |
| 61 | thycxx . . $ `melder/melder.h:45:9`! zcxx . . $ structMatrix#z..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). mycxx . . $ `melder/melder.h:44:9`! zcxx . . $ structMatrix#z..getcxx . . $ automatrix#get(b2b81450b5bdda66).(); |
| 62 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 63 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 64 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Matrix."); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /* End of file ActivationList.cpp */ |