Minsky
node_matlab.cc
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2018
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "minsky.h"
21 #include "equations.h"
22 #include "userFunction.h"
23 #include "minsky_epilogue.h"
24 using namespace minsky;
25 
26 namespace MathDAG
27 {
28  namespace
29  {
30  struct InvalidChar
31  {
32  bool operator()(char c) const {return !isalnum(c) && c!='_';}
33  };
34 
35  string validMatlabIdentifier(string name)
36  {
37  name.erase(remove_if(name.begin(), name.end(), InvalidChar()), name.end());
38  if (name.empty() || isdigit(name[0]))
39  name="_"+name;
40  return name;
41  }
42 
43  }
44 
45  string matlabInit(const string& init)
46  {
47  if (init.empty()) return "0";
48  VariableValue v;
49  v.init(init);
50  auto t=cminsky().variableValues.initValue(v);
51  string r;
52  switch (t.rank())
53  {
54  case 0: return str(t[0]);
55  case 1: r="[";
56  for (auto i: t) r+=str(i)+",";
57  return r+"]";
58  case 2:
59  r="[";
60  for (size_t i=0; i<t.hypercube().xvectors[1].size(); ++i)
61  {
62  for (size_t j=0; j<t.hypercube().xvectors[0].size(); ++j)
63  r+=str(t[i*t.hypercube().xvectors[0].size()+j])+",";
64  r+=";";
65  }
66  return r+"]";
67  default:
68  throw error("high rank tensors not supported in Matlab");
69  }
70  }
71 
72  ostream& VariableDAG::matlab(ostream& o) const
73  {
74  if (type==constant)
75  return o<<init;
76  return o<<validMatlabIdentifier(name);
77  }
78 
79  template <>
81  {
82  return o<<init;
83  }
84 
85  template <>
86  ostream& OperationDAG<OperationType::add>::matlab(ostream& o) const
87  {
88  if (arguments.empty()||
89  (arguments[0].empty() &&
90  (arguments.size()<2||arguments[1].empty())))
91  return o<<0;
92  for (size_t i=0; i<arguments[0].size(); ++i)
93  {
94  checkArg(0,i);
95  if (i>0) o<<"+";
96  o<<arguments[0][i]->matlab();
97  }
98  if (arguments.size()>1)
99  {
100  if (!arguments[0].empty() && !arguments[1].empty()) o<<"+";
101  for (size_t i=0; i<arguments[1].size(); ++i)
102  {
103  checkArg(1,i);
104  if (i>0) o<<"+";
105  o<<arguments[1][i]->matlab();
106  }
107  }
108  return o;
109  }
110 
111  template <>
113  {
114  if (arguments.empty()||
115  (arguments[0].empty() &&
116  (arguments.size()<2||arguments[1].empty())))
117  return o<<0;
118  for (size_t i=0; i<arguments[0].size(); ++i)
119  {
120  checkArg(0,i);
121  if (i>0) o<<"+";
122  o<<arguments[0][i]->matlab();
123  }
124  if (arguments.size()>1 && !arguments[1].empty()>0)
125  {
126  o<<"-(";
127  for (size_t i=0; i<arguments[1].size(); ++i)
128  {
129  checkArg(1,i);
130  if (i>0) o<<"+";
131  o<<arguments[1][i]->matlab();
132  }
133  o<<")";
134  }
135  return o;
136  }
137 
138  template <>
140  {
141  if (arguments.empty()||
142  (arguments[0].empty() &&
143  (arguments.size()<2||arguments[1].empty())))
144  return o<<1;
145  for (size_t i=0; i<arguments[0].size(); ++i)
146  {
147  checkArg(0,i);
148  if (i>0) o<<"*";
149  o<<"("<<arguments[0][i]->matlab()<<")";
150  }
151  if (!arguments[0].empty() && !arguments[1].empty()) o<<"*";
152  for (size_t i=0; i<arguments[1].size(); ++i)
153  {
154  checkArg(1,i);
155  if (i>0) o<<"*";
156  o<<"("<<arguments[1][i]->matlab()<<")";
157  }
158  return o;
159  }
160 
161  template <>
163  {
164  if (arguments.empty()||
165  (arguments[0].empty() &&
166  (arguments.size()<2||arguments[1].empty())))
167  return o<<1;
168  if (arguments[0].empty())
169  o<<"1";
170  for (size_t i=0; i<arguments[0].size(); ++i)
171  {
172  checkArg(0,i);
173  if (i>0) o<<"*";
174  o<<"("<<arguments[0][i]->matlab()<<")";
175  }
176  if (arguments.size()>1 && !arguments[1].empty())
177  {
178  o<<"/(";
179  for (size_t i=0; i<arguments[1].size(); ++i)
180  {
181  checkArg(1,i);
182  if (i>0) o<<"*";
183  o<<"("<<arguments[1][i]->matlab()<<")";
184  }
185  o<<")";
186  }
187  return o;
188  }
189 
190  template <>
191  ostream& OperationDAG<OperationType::log>::matlab(ostream& o) const
192  {
193  checkArg(0,0); checkArg(1,0);
194  return o<<"log("<<arguments[0][0]->matlab()<<")/log("<<
195  arguments[1][0]->matlab()<<")";
196  }
197 
198  template <>
199  ostream& OperationDAG<OperationType::pow>::matlab(ostream& o) const
200  {
201  checkArg(0,0); checkArg(1,0);
202  return o<<"("<<arguments[0][0]->matlab()<<")^("<<arguments[1][0]->matlab()<<")";
203  }
204 
205  template <>
206  ostream& OperationDAG<OperationType::lt>::matlab(ostream& o) const
207  {
208  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
209  o<<"(("<<arguments[0][0]->matlab()<<")";
210  else
211  o<<"(0";
212  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
213  o<<"<("<<arguments[1][0]->matlab()<<")";
214  else
215  o<<"<0";
216  return o<<")";
217  }
218 
219  template <>
220  ostream& OperationDAG<OperationType::le>::matlab(ostream& o) const
221  {
222  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
223  o<<"(("<<arguments[0][0]->matlab()<<")";
224  else
225  o<<"(0";
226  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
227  o<<"<=("<<arguments[1][0]->matlab()<<")";
228  else
229  o<<"<=0";
230  return o<<")";
231  }
232 
233  template <>
234  ostream& OperationDAG<OperationType::eq>::matlab(ostream& o) const
235  {
236  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
237  o<<"(("<<arguments[0][0]->matlab()<<")";
238  else
239  o<<"(0";
240  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
241  o<<"==("<<arguments[1][0]->matlab()<<")";
242  else
243  o<<"==0";
244  return o<<")";
245  }
246 
247  template <>
248  ostream& OperationDAG<OperationType::min>::matlab(ostream& o) const
249  {
250  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
251  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
252  o<<"min("<<arguments[0][0]->matlab()<<"," <<
253  arguments[1][0]->matlab()<<")";
254  else
255  o<<"min("<<arguments[0][0]->matlab()<<",0)";
256  else
257  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
258  o<<"min(0,"<<arguments[1][0]->matlab()<<")";
259  else
260  o<<"0";
261  return o;
262  }
263 
264  template <>
265  ostream& OperationDAG<OperationType::max>::matlab(ostream& o) const
266  {
267  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
268  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
269  o<<"max("<<arguments[0][0]->matlab()<<"," <<
270  arguments[1][0]->matlab()<<")";
271  else
272  o<<"max("<<arguments[0][0]->matlab()<<",0)";
273  else
274  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
275  o<<"max(0,"<<arguments[1][0]->matlab()<<")";
276  else
277  o<<"0";
278  return o;
279  }
280 
281  template <>
282  ostream& OperationDAG<OperationType::and_>::matlab(ostream& o) const
283  {
284  if (arguments.size()>1 && !arguments[0].empty() && arguments[0][0] &&
285  !arguments[1].empty() && arguments[1][0])
286  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5 && (" <<
287  arguments[1][0]->matlab()<<")>=0.5)";
288  else
289  o<<"0";
290  return o;
291  }
292 
293  template <>
294  ostream& OperationDAG<OperationType::or_>::matlab(ostream& o) const
295  {
296  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
297  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
298  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5 || (" <<
299  arguments[1][0]->matlab()<<")>=0.5)";
300  else
301  o<<"(("<<arguments[0][0]->matlab()<<")>=0.5)";
302  else
303  if (arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
304  o<<"(("<<arguments[1][0]->matlab()<<")>=0.5)";
305  else
306  o<<"0";
307  return o;
308  }
309 
310  template <>
311  ostream& OperationDAG<OperationType::not_>::matlab(ostream& o) const
312  {
313  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
314  o<<"(("<<arguments[0][0]->matlab()<<")<0.5)";
315  else
316  o<<"1";
317  return o;
318  }
319 
320  // note strictly speaking, corr and corrcoef in Matlab only match
321  // the Minsky definitions for vectors. In Matlab, an NxM and NxL
322  // matrix produces a MxL output. In Minsky, the two arguments must
323  // be conformant.
324  template <>
326  {
327  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
328  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
329  return o<<"cov("<<arguments[0][0]->matlab()<<"," <<
330  arguments[1][0]->matlab()<<")";
331  return o<<"0";
332  }
333 
334  template <>
336  {
337  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
338  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
339  return o<<"corr("<<arguments[0][0]->matlab()<<"," <<
340  arguments[1][0]->matlab()<<")";
341  return o<<"0";
342  }
343 
344  template <>
346  {
347  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0] &&
348  arguments.size()>1 && !arguments[1].empty() && arguments[1][0])
349  return o<<"linReg("<<arguments[0][0]->matlab()<<"," <<
350  arguments[1][0]->matlab()<<")";
351  return o<<"0";
352  }
353 
354  template <>
355  ostream& OperationDAG<OperationType::size>::matlab(ostream& o) const
356  {
357  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
358  {
359  size_t dim=numeric_limits<size_t>::max();
360  if (auto op=dynamic_cast<OperationBase*>(state.get()))
361  if (auto vv=arguments[0][0]->result)
362  {
363  for (auto& i: vv->hypercube().xvectors)
364  if (i.name==op->axis)
365  {
366  dim=&i-&vv->hypercube().xvectors.front();
367  break;
368  }
369  if (dim<vv->rank())
370  return o<<"size("<<arguments[0][0]->matlab()<<","<<dim<<")";
371  }
372  return o<<"prod(size("<<arguments[0][0]->matlab()<<"))";
373  }
374  return o<<"0";
375  }
376 
377  template <>
379  {
380  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
381  {
382  return o<<"size("<<arguments[0][0]->matlab()<<")";
383  }
384  return o<<"0";
385  }
386 
387  template <>
388  ostream& OperationDAG<OperationType::mean>::matlab(ostream& o) const
389  {
390  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
391  {
392  return o<<"mean("<<arguments[0][0]->matlab()<<")";
393  }
394  return o<<"0";
395  }
396 
397  template <>
399  {
400  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
401  {
402  return o<<"median("<<arguments[0][0]->matlab()<<")";
403  }
404  return o<<"0";
405  }
406 
407  template <>
409  {
410  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
411  {
412  return o<<"std("<<arguments[0][0]->matlab()<<")";
413  }
414  return o<<"0";
415  }
416 
417  template <>
419  {
420  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
421  {
422  double exponent=1;
423  if (auto op=dynamic_cast<OperationBase*>(state.get()))
424  exponent=op->arg;
425  return o<<"moment("<<arguments[0][0]->matlab()<<","<<exponent<<")";
426  }
427  return o<<"0";
428  }
429 
430  // note - matlab doesn't have a histogram function by default
431  template <>
433  {
434  if (!arguments.empty() && !arguments[0].empty() && arguments[0][0])
435  {
436  size_t nBins=1;
437  if (auto op=dynamic_cast<OperationBase*>(state.get()))
438  nBins=op->arg;
439  return o<<"histogram("<<arguments[0][0]->matlab()<<","<<nBins<<")";
440  }
441  return o<<"0";
442  }
443 
444  template <>
445  ostream& OperationDAG<OperationType::time>::matlab(ostream& o) const
446  {
447  return o<<"t";
448  }
449 
450  template <>
452  {
453  return o<<"e";
454  }
455 
456  template <>
457  ostream& OperationDAG<OperationType::pi>::matlab(ostream& o) const
458  {
459  return o<<"pi";
460  }
461 
462  template <>
463  ostream& OperationDAG<OperationType::zero>::matlab(ostream& o) const
464  {
465  return o<<"0";
466  }
467 
468  template <>
469  ostream& OperationDAG<OperationType::one>::matlab(ostream& o) const
470  {
471  return o<<"1";
472  }
473 
474  template <>
475  ostream& OperationDAG<OperationType::inf>::matlab(ostream& o) const
476  {
477  return o<<"inf";
478  }
479 
480  template <>
482  {
483  checkArg(0,0);
484  return o<<"100*("<<arguments[0][0]->matlab()<<")";
485  }
486 
487  template <>
488  ostream& OperationDAG<OperationType::copy>::matlab(ostream& o) const
489  {
490  if (!arguments.empty() && !arguments[0].empty())
491  {
492  assert(arguments[0][0]);
493  o<<arguments[0][0]->matlab();
494  }
495  return o;
496  }
497 
498  template <>
500  {
501  throw error("shouldn't be executed");
502  }
503 
504  template <>
506  {
507  throw error("derivative operator should not appear in matlab output");
508  }
509 
510  template <>
511  ostream& OperationDAG<OperationType::data>::matlab(ostream& o) const
512  {
513  throw error("Data blocks are not yet supported in Matlab mode");
514  return o;
515  }
516 
517  template <>
519  {
520  throw error("Ravels are not yet supported in Matlab mode");
521  return o;
522  }
523 
524  template <>
525  ostream& OperationDAG<OperationType::sqrt>::matlab(ostream& o) const
526  {
527  checkArg(0,0);
528  return o<<"sqrt("<<arguments[0][0]->matlab()<<")";
529  }
530 
531  template <>
532  ostream& OperationDAG<OperationType::exp>::matlab(ostream& o) const
533  {
534  checkArg(0,0);
535  return o<<"exp("<<arguments[0][0]->matlab()<<")";
536  }
537 
538  template <>
539  ostream& OperationDAG<OperationType::ln>::matlab(ostream& o) const
540  {
541  checkArg(0,0);
542  return o<<"log("<<arguments[0][0]->matlab()<<")";
543  }
544 
545  template <>
546  ostream& OperationDAG<OperationType::sin>::matlab(ostream& o) const
547  {
548  checkArg(0,0);
549  return o<<"sin("<<arguments[0][0]->matlab()<<")";
550  }
551 
552  template <>
553  ostream& OperationDAG<OperationType::cos>::matlab(ostream& o) const
554  {
555  checkArg(0,0);
556  return o<<"cos("<<arguments[0][0]->matlab()<<")";
557  }
558 
559  template <>
560  ostream& OperationDAG<OperationType::tan>::matlab(ostream& o) const
561  {
562  checkArg(0,0);
563  return o<<"tan("<<arguments[0][0]->matlab()<<")";
564  }
565 
566  template <>
567  ostream& OperationDAG<OperationType::asin>::matlab(ostream& o) const
568  {
569  checkArg(0,0);
570  return o<<"asin("<<arguments[0][0]->matlab()<<")";
571  }
572 
573  template <>
574  ostream& OperationDAG<OperationType::acos>::matlab(ostream& o) const
575  {
576  checkArg(0,0);
577  return o<<"acos("<<arguments[0][0]->matlab()<<")";
578  }
579 
580  template <>
581  ostream& OperationDAG<OperationType::atan>::matlab(ostream& o) const
582  {
583  checkArg(0,0);
584  return o<<"atan("<<arguments[0][0]->matlab()<<")";
585  }
586 
587  template <>
588  ostream& OperationDAG<OperationType::sinh>::matlab(ostream& o) const
589  {
590  checkArg(0,0);
591  return o<<"sinh("<<arguments[0][0]->matlab()<<")";
592  }
593 
594  template <>
595  ostream& OperationDAG<OperationType::cosh>::matlab(ostream& o) const
596  {
597  checkArg(0,0);
598  return o<<"cosh("<<arguments[0][0]->matlab()<<")";
599  }
600 
601  template <>
602  ostream& OperationDAG<OperationType::tanh>::matlab(ostream& o) const
603  {
604  checkArg(0,0);
605  return o<<"tanh("<<arguments[0][0]->matlab()<<")";
606  }
607 
608  template <>
609  ostream& OperationDAG<OperationType::abs>::matlab(ostream& o) const
610  {
611  checkArg(0,0);
612  return o<<"abs("<<arguments[0][0]->matlab()<<")";
613  }
614 
615  template <>
617  {
618  checkArg(0,0);
619  return o<<"floor("<<arguments[0][0]->matlab()<<")";
620  }
621 
622  template <>
623  ostream& OperationDAG<OperationType::frac>::matlab(ostream& o) const
624  {
625  checkArg(0,0);
626  return o<<"frac("<<arguments[0][0]->matlab()<<")";
627  }
628 
629  template <>
631  {
632  checkArg(0,0);
633  return o<<"gamma("<<arguments[0][0]->matlab()<<")";
634  }
635 
636  template <>
638  {
639  checkArg(0,0); checkArg(1,0);
640  return o<<"psi(floor("<<arguments[1][0]->matlab()<<"),("<<arguments[0][0]->matlab()<<"))";
641  }
642 
643  template <>
644  ostream& OperationDAG<OperationType::fact>::matlab(ostream& o) const
645  {
646  checkArg(0,0);
647  return o<<"gamma(1+("<<arguments[0][0]->matlab()<<"))";
648  }
649 
650  template <>
652  {
653  if (arguments.empty() || arguments[0].empty())
654  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"()";
655  if (arguments.size()<2 || arguments[1].empty())
656  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"("<<arguments[0][0]->matlab()<<")";
657  return o<<dynamic_cast<UserFunction*>(state.get())->name()<<"("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
658  }
659 
660 
661  template <>
662  ostream& OperationDAG<OperationType::sum>::matlab(ostream& o) const
663  {
664  checkArg(0,0);
665  return o<<"sum("<<arguments[0][0]->matlab()<<")";
666  }
667  template <>
669  {
670  checkArg(0,0);
671  return o<<"prod("<<arguments[0][0]->matlab()<<")";
672  }
673  template <>
675  {
676  checkArg(0,0);
677  return o<<"max("<<arguments[0][0]->matlab()<<")";
678  }
679  template <>
681  {
682  checkArg(0,0);
683  return o<<"min("<<arguments[0][0]->matlab()<<")";
684  }
685  template <>
687  {
688  checkArg(0,0);
689  return o<<"find(("<<arguments[0][0]->matlab()<<")==max("<<arguments[0][0]->matlab()<<"))";
690  }
691  template <>
693  {
694  checkArg(0,0);
695  return o<<"find(("<<arguments[0][0]->matlab()<<")==min("<<arguments[0][0]->matlab()<<"))";
696  }
697  template <>
698  ostream& OperationDAG<OperationType::any>::matlab(ostream& o) const
699  {
700  checkArg(0,0);
701  return o<<"any(("<<arguments[0][0]->matlab()<<")>0.5)";
702  }
703  template <>
704  ostream& OperationDAG<OperationType::all>::matlab(ostream& o) const
705  {
706  checkArg(0,0);
707  return o<<"all(("<<arguments[0][0]->matlab()<<")>0.5)";
708  }
709  template <>
711  {
712  checkArg(0,0);
713  return o<<"cumsum("<<arguments[0][0]->matlab()<<")";
714  }
715  template <>
717  {
718  checkArg(0,0);
719  return o<<"cumprod("<<arguments[0][0]->matlab()<<")";
720  }
721  template <>
723  {
724  checkArg(0,0);
725  return o<<"diff("<<arguments[0][0]->matlab()<<")";
726  }
727  // nb - because Matlab is oblivious to x-vectors, there is no difference between Δ⁻ and Δ⁺
728  template <>
730  {
731  checkArg(0,0);
732  return o<<"diff("<<arguments[0][0]->matlab()<<")";
733  }
734  template <>
736  {
737  checkArg(0,0);
738  checkArg(1,0);
739  return o<<"("<<arguments[0][0]->matlab()<<")*("<<arguments[1][0]->matlab()<<")";
740  }
741  template <>
743  {
744  checkArg(0,0);
745  checkArg(1,0);
746  // note matlab can only deal with rank 2 tensors - this works if both are vectors, or one is a scalar and the other a matrix
747  return o<<"("<<arguments[0][0]->matlab()<<").*transpose("<<arguments[1][0]->matlab()<<")";
748  }
749  template <>
751  {
752  checkArg(0,0);
753  return o<<"find(("<<arguments[0][0]->matlab()<<")>0.5)";
754  }
755  template <>
757  {
758  checkArg(0,0);checkArg(1,0);
759  return o<<"("<<arguments[0][0]->matlab()<<")("<<arguments[1][0]->matlab()<<")";
760  }
761  template <>
762  ostream& OperationDAG<OperationType::meld>::matlab(ostream& o) const
763  {
764  checkArg(0,0);checkArg(1,0);
765  return o<<"meld("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
766  }
767  template <>
769  {
770  checkArg(0,0);checkArg(1,0);
771  return o<<"meld("<<arguments[0][0]->matlab()<<","<<arguments[1][0]->matlab()<<")";
772  }
773  template <>
775  {
776  checkArg(0,0);checkArg(1,0);
777  double slice=0;
778  if (state)
779  if (auto o=state->operationCast())
780  slice=o->arg;
781  return o<<"slice("<<arguments[0][0]->matlab()<<","<<slice<<")";
782  }
783 
784 }
ostream & matlab(ostream &o) const override
writes a matlab representation of this DAG to the stream
TensorVal initValue(const VariableValue &, std::set< std::string > &visited) const
evaluates the initial value of a given variableValue in the context given by this. visited is used to check for circular definitions
VariableValues variableValues
Definition: minsky.h:200
const std::string & init() const
struct TCLcmd::trap::init_t init
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
string matlabInit(const string &)
convert an initialisation string into a matlab expression
Definition: node_matlab.cc:45
std::string str(T x)
utility function to create a string representation of a numeric type
Definition: str.h:33
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549