Overview
Comment:Tracking Matlab's ever-changing API.
Updated to Matlab 6.5:
- removed mxSetName
- mexGetArray -> mexGetVariable
- mexPutArray -> mexPutVariable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: cddb779670619a15224912b9b542270bf31a5ed3f9de06eaee4dc73aa2631dc5
User & Date: geraint@users.sourceforge.net on 2003-03-10 12:07:25
Other Links: branch diff | manifest | tags
Context
2003-03-11
13:46:03
Added check for non-finite array elements. check-in: 9d2714a327 user: geraint@users.sourceforge.net tags: origin/master, trunk
2003-03-10
12:07:25
Tracking Matlab's ever-changing API.
Updated to Matlab 6.5:
- removed mxSetName
- mexGetArray -> mexGetVariable
- mexPutArray -> mexPutVariable
check-in: cddb779670 user: geraint@users.sourceforge.net tags: origin/master, trunk
2003-02-28
09:12:17
Two more columns in _stuc.txt: causality and subsystem name check-in: d7385976d5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl from [79b281c10a] to [313e83ce42].

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

  double *p;

  PRINT_ENTER;

  /* starting value for solver - start with zero */
  MTT_MATLAB_Ui = mxCreateDoubleMatrix (MTTNYZ, 1, mxREAL);
  mxSetName (MTT_MATLAB_Ui, "MTT_Ui");
  p = mxGetPr (MTT_MATLAB_Ui);
  for (i = 0; i < MTTNYZ; i++) {
    p[i] = 0.0;
  }
  mexPutArray (MTT_MATLAB_Ui, "base");

  /* put states into matlab workspace */
  MTT_MATLAB_X = mxCreateDoubleMatrix (MTTNX, 1, mxREAL);
  mxSetName (MTT_MATLAB_X, "MTT_X");
  p = mxGetPr (MTT_MATLAB_X);
  for (i = 0; i < MTTNX; i++) {
    p[i] = mttx[i];
  }
  mexPutArray (MTT_MATLAB_X, "base");

  /* put known inputs into matlab workspace */
  MTT_MATLAB_U = mxCreateDoubleMatrix (MTTNU, 1, mxREAL);
  mxSetName (MTT_MATLAB_U, "MTT_U");
  p = mxGetPr (MTT_MATLAB_U);
  for (i = 0; i < MTTNU; i++) {
    p[i] = mttu[i];
  }
  mexPutArray (MTT_MATLAB_U, "base");

  /* put time into matlab workspace */
  MTT_MATLAB_T = mxCreateDoubleMatrix (1, 1, mxREAL);
  mxSetName (MTT_MATLAB_T, "MTT_T");
  *mxGetPr (MTT_MATLAB_T) = mttt;
  mexPutArray (MTT_MATLAB_T, "base");

  /* put parameters into matlab workspace */
  MTT_MATLAB_P = mxCreateDoubleMatrix (MTTNPAR, 1, mxREAL);
  mxSetName (MTT_MATLAB_P, "MTT_P");
  p = mxGetPr (MTT_MATLAB_P);
  for (i = 0; i < MTTNPAR; i++) {
    p[i] = mttpar[i];
  }
  mexPutArray (MTT_MATLAB_P, "base");

  /* call solver */
  mexEvalString ("MTT_Ui = lsqnonlin (@<mtt_model_name>_sfun_ae, MTT_Ui, [], [], optimset('display','off','diagnostics','off','TolX',1e-2,'TolFun',1e-2), MTT_X, MTT_U, MTT_T, MTT_P);");

  /* retrieve result */
  MTT_MATLAB_Ui = mexGetArray ("MTT_Ui", "base");
  p = mxGetPr (MTT_MATLAB_Ui);
  for (i = 0; i < MTTNYZ; i++) {
    mttu[MTTNU + i] = p[i];
  }

  /* free memory */
  mxDestroyArray (MTT_MATLAB_P);







<




|



<




|



<




|



<

|



<




|





|







121
122
123
124
125
126
127

128
129
130
131
132
133
134
135

136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151

152
153
154
155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

  double *p;

  PRINT_ENTER;

  /* starting value for solver - start with zero */
  MTT_MATLAB_Ui = mxCreateDoubleMatrix (MTTNYZ, 1, mxREAL);

  p = mxGetPr (MTT_MATLAB_Ui);
  for (i = 0; i < MTTNYZ; i++) {
    p[i] = 0.0;
  }
  mexPutVariable ("base", "MTT_Ui", MTT_MATLAB_Ui);

  /* put states into matlab workspace */
  MTT_MATLAB_X = mxCreateDoubleMatrix (MTTNX, 1, mxREAL);

  p = mxGetPr (MTT_MATLAB_X);
  for (i = 0; i < MTTNX; i++) {
    p[i] = mttx[i];
  }
  mexPutVariable ("base", "MTT_X", MTT_MATLAB_X);

  /* put known inputs into matlab workspace */
  MTT_MATLAB_U = mxCreateDoubleMatrix (MTTNU, 1, mxREAL);

  p = mxGetPr (MTT_MATLAB_U);
  for (i = 0; i < MTTNU; i++) {
    p[i] = mttu[i];
  }
  mexPutVariable ("base", "MTT_U", MTT_MATLAB_U);

  /* put time into matlab workspace */
  MTT_MATLAB_T = mxCreateDoubleMatrix (1, 1, mxREAL);

  *mxGetPr (MTT_MATLAB_T) = mttt;
  mexPutVariable ("base", "MTT_T", MTT_MATLAB_T);

  /* put parameters into matlab workspace */
  MTT_MATLAB_P = mxCreateDoubleMatrix (MTTNPAR, 1, mxREAL);

  p = mxGetPr (MTT_MATLAB_P);
  for (i = 0; i < MTTNPAR; i++) {
    p[i] = mttpar[i];
  }
  mexPutVariable ("base", "MTT_P", MTT_MATLAB_P);

  /* call solver */
  mexEvalString ("MTT_Ui = lsqnonlin (@<mtt_model_name>_sfun_ae, MTT_Ui, [], [], optimset('display','off','diagnostics','off','TolX',1e-2,'TolFun',1e-2), MTT_X, MTT_U, MTT_T, MTT_P);");

  /* retrieve result */
  MTT_MATLAB_Ui = mexGetVariable ("base", "MTT_Ui");
  p = mxGetPr (MTT_MATLAB_Ui);
  for (i = 0; i < MTTNYZ; i++) {
    mttu[MTTNU + i] = p[i];
  }

  /* free memory */
  mxDestroyArray (MTT_MATLAB_P);


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]