Debian Codegraph @

dwtools/ActivationList.cpp

raw symbols SCIP
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"
20
21 Thing_implement (ActivationList, Matrix, 2);
22
23 int _ActivationList_checkElements (ActivationList me) {
24 for (integer i = 1; i <= my ny; i ++) {
25 for (integer j = 1; j <= my nx; j ++) {
26 if (my z [i] [j] < 0.0 || my z [i] [j] > 1.0) {
27 return 0;
28 }
29 }
30 }
31 return 1;
32 }
33
34 void ActivationList_init (ActivationList me, integer ny, integer nx) {
35 Matrix_init (me, 1.0, nx, nx, 1.0, 1.0, 1.0, ny, ny, 1.0, 1.0);
36 }
37
38 autoActivationList ActivationList_create (integer ny, integer nx) {
39 try {
40 autoActivationList me = Thing_new (ActivationList);
41 ActivationList_init (me.get(), ny, nx);
42 return me;
43 } catch (MelderError) {
44 Melder_throw (U"Activation not created.");
45 }
46 }
47
48 autoActivationList Matrix_to_ActivationList (Matrix me) {
49 try {
50 autoActivationList thee = ActivationList_create (my ny, my nx);
51 thy z.all() <<= my z.get();
52 return thee;
53 } catch (MelderError) {
54 Melder_throw (me, U": not converted to ActivationList.");
55 }
56 }
57
58 autoMatrix ActivationList_to_Matrix (ActivationList me) {
59 try {
60 autoMatrix thee = Matrix_create (my xmin, my xmax, my nx, my dx, my x1, my ymin, my ymax, my ny, my dy, my y1);
61 thy z.all() <<= my z.get();
62 return thee;
63 } catch (MelderError) {
64 Melder_throw (me, U": not converted to Matrix.");
65 }
66 }
67
68 /* End of file ActivationList.cpp */