| 1 |
/* DataModeler_def.h |
| 2 |
* |
| 3 |
* Copyright (C) 2014-2024 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 |
#define ooSTRUCT DataModelerData |
| 20 |
oo_DEFINE_STRUCT (DataModelerData) |
| 21 |
|
| 22 |
oo_DOUBLE (x) |
| 23 |
oo_DOUBLE (y) |
| 24 |
oo_DOUBLE (sigmaY) |
| 25 |
oo_ENUM (kDataModelerData, status) |
| 26 |
|
| 27 |
oo_END_STRUCT ( DataModelerData) |
| 28 |
#undef ooSTRUCT |
| 29 |
|
| 30 |
#define ooSTRUCT DataModelerParameter |
| 31 |
oo_DEFINE_STRUCT (DataModelerParameter) |
| 32 |
|
| 33 |
oo_DOUBLE (value) |
| 34 |
oo_ENUM (kDataModelerParameterStatus, status) |
| 35 |
|
| 36 |
oo_END_STRUCT (DataModelerParameter) |
| 37 |
#undef ooSTRUCT |
| 38 |
|
| 39 |
|
| 40 |
#define ooSTRUCT DataModeler |
| 41 |
oo_DEFINE_CLASS (DataModeler, Function) |
| 42 |
|
| 43 |
oo_ENUM (kDataModelerFunction, type) // polynomial, legendre ... |
| 44 |
oo_INTEGER (numberOfDataPoints) |
| 45 |
oo_INTEGER (numberOfParameters) |
| 46 |
oo_STRUCTVEC (DataModelerData, data, numberOfDataPoints) |
| 47 |
oo_STRUCTVEC (DataModelerParameter, parameters, numberOfParameters) |
| 48 |
oo_STRING_VECTOR (parameterNames, numberOfParameters) |
| 49 |
#if ! oo_READING |
| 50 |
oo_STRING (xVariableName) |
| 51 |
oo_STRING (yVariableName) |
| 52 |
#else |
| 53 |
oo_VERSION_UNTIL (2) |
| 54 |
xVariableName = Melder_dup (U""); |
| 55 |
yVariableName = Melder_dup (U""); |
| 56 |
oo_VERSION_ELSE |
| 57 |
oo_STRING (xVariableName) |
| 58 |
oo_STRING (yVariableName) |
| 59 |
oo_VERSION_END |
| 60 |
#endif |
| 61 |
oo_DOUBLE (tolerance) |
| 62 |
oo_ENUM (kDataModelerWeights, weighData) |
| 63 |
oo_OBJECT (Covariance, 0, parameterCovariances) |
| 64 |
#if oo_DECLARING |
| 65 |
double (*f_evaluate) (DataModeler me, double x, vector<structDataModelerParameter> p); |
| 66 |
void (*f_evaluateBasisFunctions) (DataModeler me, double x, VEC term) { }; |
| 67 |
void (*fit) (DataModeler me); |
| 68 |
void (*evaluateDerivative) (DataModeler me, double x, vector<structDataModelerParameter> p, VEC derivative); |
| 69 |
longdouble (*scaleX) (DataModeler me, double x); |
| 70 |
void v1_info () |
| 71 |
override; |
| 72 |
#endif |
| 73 |
|
| 74 |
#if oo_COPYING |
| 75 |
DataModeler_setBasisFunctions (thee, thy type); |
| 76 |
#endif |
| 77 |
|
| 78 |
#if oo_READING |
| 79 |
DataModeler_setBasisFunctions (this, type); |
| 80 |
#endif |
| 81 |
|
| 82 |
oo_END_CLASS (DataModeler) |
| 83 |
#undef ooSTRUCT |
| 84 |
|
| 85 |
/* End of file DataModeler_def.h */ |