INMOST
Mathematical Modelling Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
inmost_expression.h
Go to the documentation of this file.
1 #ifndef INMOST_AUTODIFF_ETEXPR_H_INCLUDED
2 #define INMOST_AUTODIFF_ETEXPR_H_INCLUDED
3 #include "inmost_common.h"
4 #include "inmost_sparse.h"
5 #include <sstream> //for debug
6 #include <new>
7 
8 #if defined(USE_AUTODIFF) && !defined(USE_SOLVER)
9 #warning "USE_AUTODIFF require USE_SOLVER"
10 #undef USE_AUTODIFF
11 #endif
12 
13 
14 //TODO:
15 // 1. Incorporate tables
16 // 2. (ok, test) implement condition
17 // 3. (ok, test) implement stencil
18 // 4. (???) copying of basic_dynamic_variable
19 // 5. Consider optimization by checking zero variation multipliers, check that assembly do not degrade.
20 // 6. floor, ceil, atan, acos, asin, max, min functions
21 // 7. choice of directional derivatives at discontinuities for abs, pow, max, min (see ADOL-C)
22 
23 
24 #if defined(USE_AUTODIFF)
25 namespace INMOST
26 {
27 
28 
29 
30 
31 
33  {
34  public:
35  basic_expression() {}//std::cout << this << " Created" << std::endl;}
36  basic_expression(const basic_expression & other) {};//std::cout << this << " Created from " << &other << std::endl;}
37  virtual INMOST_DATA_REAL_TYPE GetValue() const = 0;
38  virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const = 0;
39  virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const = 0;
40  //virtual ~basic_expression() {std::cout << this << " Destroied" << std::endl;}
41  };
42 
43  template<class Derived>
44  class shell_expression : virtual public basic_expression
45  {
46  public:
47  shell_expression() {}//std::cout << this << " Shell Created for " << dynamic_cast<basic_expression *>(this) << std::endl;}
48  shell_expression(const shell_expression & other) {}//std::cout << this << " Shell Created from " << &other << std::endl;}
49  __INLINE virtual INMOST_DATA_REAL_TYPE GetValue() const {return static_cast<const Derived *>(this)->GetValue(); }
50  __INLINE virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const { return static_cast<const Derived *>(this)->GetDerivative(mult,r); }
51  __INLINE virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const { return static_cast<const Derived *>(this)->GetDerivative(mult,r); }
52  operator Derived & () {return *static_cast<Derived *>(this);}
53  operator const Derived & () const {return *static_cast<const Derived *>(this);}
54  //~shell_expression() {std::cout << this << " Shell Destroied for " << dynamic_cast<basic_expression *>(this) << std::endl;}
55  //Derived * GetDerived() { return dynamic_cast<Derived *>(this); }
56  };
57 
58 
59 
60 
61 
62 
63  class var_expression : public shell_expression<var_expression>
64  {
67  public:
68  var_expression(const var_expression & other) :value(other.value), index(other.index) {}
69  var_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex) : value(pvalue), index(pindex) {}
70  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
71  __INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {if( index != ENUMUNDEF ) r[index] += mult;}
72  __INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {if( index != ENUMUNDEF ) r[index] += mult;}
74  {
75  value = other.value;
76  index = other.index;
77  return *this;
78  }
79  bool check_nans() const
80  {
81  return value != value;
82  }
83  };
84 
85 
86  class multivar_expression : public shell_expression<multivar_expression>
87  {
89  Sparse::Row entries;
90  public:
91  multivar_expression() :value(0) {}
92  multivar_expression(INMOST_DATA_REAL_TYPE pvalue) : value(pvalue) {}
93  multivar_expression(const multivar_expression & other) : value(other.value), entries(other.entries) {}
95  : value(pvalue), entries(pentries) {}
97  : value(pvalue)
98  {
99  entries.Push(pindex,pdmult);
100  }
102  {
103  expr.GetDerivative(1.0,entries);
104  value = expr.GetValue();
105  }
106  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
107  __INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; }
109  {
110  for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it)
111  r[it->first] += it->second*mult;
112  }
114  {
115  for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it)
116  r[it->first] += it->second*mult;
117  }
119  {
120  value = pvalue;
121  entries.Clear();
122  return *this;
123  }
125  {
126  value = expr.GetValue();
127  Sparse::Row tmp;
128  expr.GetDerivative(1.0,tmp);
129  entries.Swap(tmp);
130  return *this;
131  }
133  {
134  value = other.value;
135  entries = other.entries;
136  return *this;
137  }
138  __INLINE Sparse::Row & GetRow() {return entries;}
139  __INLINE const Sparse::Row & GetRow() const {return entries;}
141  {
142  value += expr.GetValue();
143  Sparse::Row tmp(entries);
144  expr.GetDerivative(1.0,tmp);
145  entries.Swap(tmp);
146  return *this;
147  }
149  {
150  value -= expr.GetValue();
151  Sparse::Row tmp(entries);
152  expr.GetDerivative(-1.0,tmp);
153  entries.Swap(tmp);
154  return *this;
155  }
157  {
158  INMOST_DATA_REAL_TYPE lval = value, rval = expr.GetValue();
159  Sparse::Row tmp(entries);
160  for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= rval;
161  expr.GetDerivative(lval,tmp);
162  entries.Swap(tmp);
163  value *= rval;
164  return *this;
165  }
167  {
168  INMOST_DATA_REAL_TYPE lval = value, rval = expr.GetValue();
169  INMOST_DATA_REAL_TYPE reciprocial_rval = 1.0/rval;
170  value *= reciprocial_rval;
171  Sparse::Row tmp(entries);
172  for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= reciprocial_rval;
173  expr.GetDerivative(-value*reciprocial_rval,tmp);
174  entries.Swap(tmp);
175  return *this;
176  }
178  {
179  value += right;
180  return *this;
181  }
183  {
184  value -= right;
185  return *this;
186  }
188  {
189  value *= right;
190  for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it) it->second *= right;
191  return *this;
192  }
194  {
195  value /= right;
196  for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it) it->second /= right;
197  return *this;
198  }
199  bool check_nans() const
200  {
201  if( value != value ) return true;
202  for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it)
203  if( it->second != it->second ) return true;
204  return false;
205  }
206  };
207 
208  template<class A>
209  class const_multiplication_expression : public shell_expression<const_multiplication_expression<A> >
210  {
211  const A & arg;
212  INMOST_DATA_REAL_TYPE value, dmult;
213  public:
214  const_multiplication_expression(const shell_expression<A> & parg,INMOST_DATA_REAL_TYPE pdmult) : arg(parg), dmult(pdmult)
215  {
216  value = arg.GetValue()*dmult;
217  }
218  const_multiplication_expression(const const_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
219  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
221  {
222  arg.GetDerivative(mult*dmult,r);
223  }
225  {
226  arg.GetDerivative(mult*dmult,r);
227  }
228  };
229 
230  template<class A>
231  class variation_multiplication_expression : public shell_expression<variation_multiplication_expression<A> >
232  {
233  const A & arg;
234  INMOST_DATA_REAL_TYPE value, dmult;
235  public:
236  variation_multiplication_expression(const shell_expression<A> & parg,INMOST_DATA_REAL_TYPE pdmult) : arg(parg), dmult(pdmult)
237  {
238  value = arg.GetValue();
239  }
240  variation_multiplication_expression(const variation_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
241  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
243  {
244  arg.GetDerivative(mult*dmult,r);
245  }
247  {
248  arg.GetDerivative(mult*dmult,r);
249  }
250  };
251 
252 
253  template<class A>
254  class const_division_expression : public shell_expression<const_division_expression<A> >
255  {
256  const A & arg;
257  INMOST_DATA_REAL_TYPE value, dmult;
258  public:
259  const_division_expression(const shell_expression<A> & parg,INMOST_DATA_REAL_TYPE pdmult) : arg(parg), dmult(pdmult)
260  {
261  dmult = 1.0/dmult;
262  value = arg.GetValue()*dmult;
263  }
264  const_division_expression(const const_division_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
265  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
267  {
268  arg.GetDerivative(mult*dmult,r);
269  }
271  {
272  arg.GetDerivative(mult*dmult,r);
273  }
274  };
275 
276  template<class A>
277  class const_addition_expression : public shell_expression<const_addition_expression<A> >
278  {
279  const A & arg;
280  INMOST_DATA_REAL_TYPE value;
281  public:
283  {
284  value = arg.GetValue()+padd;
285  }
286  const_addition_expression(const const_addition_expression & other) : arg(other.arg), value(other.value) {}
287  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
289  {
290  arg.GetDerivative(mult,r);
291  }
293  {
294  arg.GetDerivative(mult,r);
295  }
296  };
297 
298  template<class A>
299  class const_subtraction_expression : public shell_expression<const_subtraction_expression<A> >
300  {
301  const A & arg;
302  INMOST_DATA_REAL_TYPE value;
303  public:
305  {
306  value = pleft-arg.GetValue();
307  }
308  const_subtraction_expression(const const_subtraction_expression & other) : arg(other.arg), value(other.value) {}
309  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
311  {
312  arg.GetDerivative(-mult,r);
313  }
315  {
316  arg.GetDerivative(-mult,r);
317  }
318  };
319 
320  template<class A>
321  class reciprocal_expression : public shell_expression<reciprocal_expression<A> >
322  {
323  const A & arg;
324  INMOST_DATA_REAL_TYPE value, dmult;
325  public:
326  reciprocal_expression(const shell_expression<A> & parg,INMOST_DATA_REAL_TYPE pdmult) : arg(parg), dmult(pdmult)
327  {
328  value = dmult/arg.GetValue();
329  }
330  reciprocal_expression(const reciprocal_expression & other) : arg(other.arg), value(other.value) {}
331  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
333  {
334  arg.GetDerivative(-mult*dmult*value*value,r);
335  }
337  {
338  arg.GetDerivative(-mult*dmult*value*value,r);
339  }
340  };
341 
342  template<class A>
343  class unary_minus_expression : public shell_expression<unary_minus_expression<A> >
344  {
345  const A & arg;
346  INMOST_DATA_REAL_TYPE value;
347  public:
348  unary_minus_expression(const shell_expression<A> & parg) : arg(parg) {value = -arg.GetValue();}
350  __INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
352  {
353  arg.GetDerivative(-mult,r);
354  }
356  {
357  arg.GetDerivative(-mult,r);
358  }
359  };
360 
361  template<class A>
362  class abs_expression : public shell_expression<abs_expression<A> >
363  {
364  const A & arg;
365  INMOST_DATA_REAL_TYPE value, dmult;
366  public:
367  abs_expression(const shell_expression<A> & parg) : arg(parg)
368  {
369  value = arg.GetValue();
370  dmult = value < 0.0 ? -1.0 : 1.0;
371  value = ::fabs(value);
372  }
373  abs_expression(const abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
374  __INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
376  {
377  arg.GetDerivative( mult * dmult, r);
378  }
380  {
381  arg.GetDerivative( mult * dmult, r);
382  }
383  };
384 
385  template<class A>
386  class exp_expression : public shell_expression<exp_expression<A> >
387  {
388  const A & arg;
389  INMOST_DATA_REAL_TYPE value;
390  public:
391  exp_expression(const shell_expression<A> & parg) : arg(parg)
392  {
393  value = arg.GetValue();
394  value = ::exp(value);
395  }
396  exp_expression(const exp_expression & b) : arg(b.arg), value(b.value) {}
397  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
399  {
400  arg.GetDerivative( mult * value, r);
401  }
403  {
404  arg.GetDerivative( mult * value, r);
405  }
406  };
407 
408  template<class A>
409  class log_expression : public shell_expression<log_expression<A> >
410  {
411  const A & arg;
412  INMOST_DATA_REAL_TYPE value, dmult;
413  public:
414  log_expression(const shell_expression<A> & parg) : arg(parg)
415  {
416  value = arg.GetValue();
417  dmult = 1.0/value;
418  value = ::log(value);
419  }
420  log_expression(const log_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
421  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
423  {
424  arg.GetDerivative(mult*dmult,r);
425  }
427  {
428  arg.GetDerivative(mult*dmult,r);
429  }
430  };
431 
432 
433  template<class A>
434  class sin_expression : public shell_expression<sin_expression<A> >
435  {
436  const A & arg;
437  INMOST_DATA_REAL_TYPE value, dmult;
438  public:
439  sin_expression(const shell_expression<A> & parg) : arg(parg)
440  {
441  value = arg.GetValue();
442  dmult = ::cos(value);
443  value = ::sin(value);
444  }
445  sin_expression(const sin_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
446  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
448  {
449  arg.GetDerivative(mult*dmult,r);
450  }
452  {
453  arg.GetDerivative(mult*dmult,r);
454  }
455  };
456 
457  template<class A>
458  class cos_expression : public shell_expression<cos_expression<A> >
459  {
460  const A & arg;
461  INMOST_DATA_REAL_TYPE value, dmult;
462  public:
463  cos_expression(const shell_expression<A> & parg) : arg(parg)
464  {
465  value = arg.GetValue();
466  dmult = -(::sin(value));
467  value = ::cos(value);
468  }
469  cos_expression(const cos_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
470  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
472  {
473  arg.GetDerivative(mult*dmult,r);
474  }
476  {
477  arg.GetDerivative(mult*dmult,r);
478  }
479  };
480 
481  template<class A>
482  class sqrt_expression : public shell_expression<sqrt_expression<A> >
483  {
484  const A & arg;
485  INMOST_DATA_REAL_TYPE value;
486  public:
487  sqrt_expression(const shell_expression<A> & parg) : arg(parg)
488  {
489  value = ::sqrt(arg.GetValue());
490  }
491  sqrt_expression(const sqrt_expression & b) : arg(b.arg), value(b.value) {}
492  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
494  {
495  arg.GetDerivative(0.5*mult/value,r);
496  }
498  {
499  arg.GetDerivative(0.5*mult/value,r);
500  }
501  };
502 
503 
504  template<class A>
505  class soft_abs_expression : public shell_expression<soft_abs_expression<A> >
506  {
507  const A & arg;
508  INMOST_DATA_REAL_TYPE value, dmult;
509  public:
511  {
512  INMOST_DATA_REAL_TYPE lval = arg.GetValue();
513  value = ::sqrt(lval*lval+tol*tol);
514  dmult = lval/value;
515  }
516  soft_abs_expression(const soft_abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
517  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
519  {
520  arg.GetDerivative(mult*dmult,r);
521  }
523  {
524  arg.GetDerivative(mult*dmult,r);
525  }
526  };
527 
528  template<class A>
529  class soft_sign_expression : public shell_expression<soft_sign_expression<A> >
530  {
531  const A & arg;
532  INMOST_DATA_REAL_TYPE value, dmult;
533  public:
535  {
536  INMOST_DATA_REAL_TYPE lval = arg.GetValue(), lval2 = lval*lval;
537  INMOST_DATA_REAL_TYPE div = lval2+tol*tol;
538  INMOST_DATA_REAL_TYPE sdiv = ::sqrt(div);
539  value = lval/sdiv;
540  dmult = (1.0 - lval2/div)/sdiv;
541  }
542  soft_sign_expression(const soft_sign_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
543  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
545  {
546  arg.GetDerivative(mult*dmult,r);
547  }
549  {
550  arg.GetDerivative(mult*dmult,r);
551  }
552  };
553 
554  template<class A, class B>
555  class soft_max_expression : public shell_expression<soft_max_expression<A,B> >
556  {
557  const A & left;
558  const B & right;
559  INMOST_DATA_REAL_TYPE value, ldmult, rdmult;
560  public:
561  soft_max_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright, INMOST_DATA_REAL_TYPE tol) : left(pleft), right(pright)
562  {
563  INMOST_DATA_REAL_TYPE lval = left.GetValue(), rval = right.GetValue();
564  INMOST_DATA_REAL_TYPE diff = lval-rval, root = ::sqrt(diff*diff+tol*tol);
565  value = 0.5*(lval+rval + root);
566  ldmult = 0.5*(1 + diff/root);
567  rdmult = 0.5*(1 - diff/root);
568  }
570  : left(other.left), right(other.right), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
571  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
573  {
574  left.GetDerivative(mult*ldmult,r);
575  right.GetDerivative(mult*rdmult,r);
576  }
578  {
579  left.GetDerivative(mult*ldmult,r);
580  right.GetDerivative(mult*rdmult,r);
581  }
582  };
583 
584  template<class A, class B>
585  class soft_min_expression : public shell_expression<soft_min_expression<A,B> >
586  {
587  const A & left;
588  const B & right;
589  INMOST_DATA_REAL_TYPE value, ldmult, rdmult;
590  public:
591  soft_min_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright, INMOST_DATA_REAL_TYPE tol) : left(pleft), right(pright)
592  {
593  INMOST_DATA_REAL_TYPE lval = left.GetValue(), rval = right.GetValue();
594  INMOST_DATA_REAL_TYPE diff = lval-rval, root = ::sqrt(diff*diff+tol*tol);
595  value = 0.5*(lval+rval - root);
596  ldmult = 0.5*(1 - diff/root);
597  rdmult = 0.5*(1 + diff/root);
598  }
600  : left(other.left), right(other.right), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
601  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
603  {
604  left.GetDerivative(mult*ldmult,r);
605  right.GetDerivative(mult*rdmult,r);
606  }
608  {
609  left.GetDerivative(mult*ldmult,r);
610  right.GetDerivative(mult*rdmult,r);
611  }
612  };
613 
614 
615  template<class A, class B>
616  class multiplication_expression : public shell_expression<multiplication_expression<A,B> >
617  {
618  const A & left;
619  const B & right;
620  INMOST_DATA_REAL_TYPE value, ldmult, rdmult;
621  public:
622  multiplication_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright) : left(pleft), right(pright)
623  {
624  rdmult = left.GetValue();
625  ldmult = right.GetValue();
626  value = rdmult*ldmult;
627  }
629  : left(other.left), right(other.right), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
630  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
632  {
633  left.GetDerivative(mult*ldmult,r);
634  right.GetDerivative(mult*rdmult,r);
635  }
637  {
638  left.GetDerivative(mult*ldmult,r);
639  right.GetDerivative(mult*rdmult,r);
640  }
641  };
642 
643  template<class A, class B>
644  class division_expression : public shell_expression<division_expression<A,B> >
645  {
646  const A & left;
647  const B & right;
648  INMOST_DATA_REAL_TYPE value, reciprocal_rval;
649  public:
650  division_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright) : left(pleft), right(pright)
651  {
652  INMOST_DATA_REAL_TYPE lval = left.GetValue();
653  INMOST_DATA_REAL_TYPE rval = right.GetValue();
654  reciprocal_rval = 1.0 / rval;
655  value = lval * reciprocal_rval;
656  }
657  division_expression(const division_expression & other) : left(other.left), right(other.right), value(other.value), reciprocal_rval(other.reciprocal_rval) {}
658  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
660  {
661  left.GetDerivative(mult * reciprocal_rval,r);
662  right.GetDerivative(- mult * value * reciprocal_rval,r);
663  }
665  {
666  left.GetDerivative(mult * reciprocal_rval,r);
667  right.GetDerivative(- mult * value * reciprocal_rval,r);
668  }
669  };
670 
671  template<class A, class B>
672  class addition_expression : public shell_expression<addition_expression<A,B> >
673  {
674  const A & left;
675  const B & right;
676  INMOST_DATA_REAL_TYPE value;
677  public:
678  addition_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright) : left(pleft), right(pright)
679  {
680  value = left.GetValue() + right.GetValue();
681  }
683  : left(other.left), right(other.right), value(other.value) {}
684  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
686  {
687  left.GetDerivative(mult,r);
688  right.GetDerivative(mult,r);
689  }
691  {
692  left.GetDerivative(mult,r);
693  right.GetDerivative(mult,r);
694  }
695  };
696 
697  template<class A, class B>
698  class subtraction_expression : public shell_expression<subtraction_expression<A,B> >
699  {
700  const A & left;
701  const B & right;
702  INMOST_DATA_REAL_TYPE value;
703  public:
704  subtraction_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright) : left(pleft), right(pright)
705  {
706  value = left.GetValue() - right.GetValue();
707  }
709  : left(other.left), right(other.right),value(other.value) {}
710  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
712  {
713  left.GetDerivative(mult,r);
714  right.GetDerivative(-mult,r);
715  }
717  {
718  left.GetDerivative(mult,r);
719  right.GetDerivative(-mult,r);
720  }
721  };
722 
723  template<class A, class B>
724  class pow_expression : public shell_expression<pow_expression<A,B> >
725  {
726  const A & left;
727  const B & right;
728  INMOST_DATA_REAL_TYPE value, ldmult, rdmult;
729  public:
730  pow_expression(const shell_expression<A> & pleft, const shell_expression<B> & pright) : left(pleft), right(pright)
731  {
732  INMOST_DATA_REAL_TYPE lval = left.GetValue();
733  INMOST_DATA_REAL_TYPE rval = right.GetValue();
734  value = ::pow(lval,rval);
735  if( lval != 0 )
736  {
737  ldmult = value * rval / lval;
738  rdmult = value * ::log(lval);
739  }
740  else
741  {
742  ldmult = 0;
743  rdmult = 0;
744  }
745  }
747  :left(other.left), right(other.right), value(other.value),
748  ldmult(other.ldmult), rdmult(other.rdmult) {}
749  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
751  {
752  left.GetDerivative(mult*ldmult,r);
753  right.GetDerivative(mult*rdmult,r);
754  }
756  {
757  left.GetDerivative(mult*ldmult,r);
758  right.GetDerivative(mult*rdmult,r);
759  }
760  };
761 
762  template<class A>
763  class pow_const_expression : public shell_expression<pow_const_expression<A> >
764  {
765  const A & left;
766  INMOST_DATA_REAL_TYPE value, ldmult;
767  public:
769  {
770  INMOST_DATA_REAL_TYPE lval = left.GetValue();
771  value = ::pow(lval,pright);
772  if( lval != 0 )
773  ldmult = value * pright / lval;
774  else
775  ldmult = 0;
776  }
778  :left(other.left), value(other.value), ldmult(other.ldmult) {}
779  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
781  {
782  left.GetDerivative(mult*ldmult,r);
783  }
785  {
786  left.GetDerivative(mult*ldmult,r);
787  }
788  };
789 
790  template<class A>
791  class const_pow_expression : public shell_expression<const_pow_expression<A> >
792  {
793  const A & right;
794  INMOST_DATA_REAL_TYPE value, rdmult;
795  public:
796  const_pow_expression(INMOST_DATA_REAL_TYPE pleft, const shell_expression<A> & pright) : right(pright)
797  {
798  INMOST_DATA_REAL_TYPE rval = right.GetValue();
799  value = ::pow(pleft,rval);
800  if( pleft != 0 )
801  rdmult = value * ::log(pleft);
802  else
803  rdmult = 0;
804  }
806  :right(other.right), value(other.value), rdmult(other.rdmult) {}
807  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
809  {
810  right.GetDerivative(mult*rdmult,r);
811  }
813  {
814  right.GetDerivative(mult*rdmult,r);
815  }
816  };
817 
818  template<class A, class B, class C>
819  class condition_expression : public shell_expression<condition_expression<A,B,C> >
820  {
821  const A & cond;
822  const B & left;
823  const C & right;
824  INMOST_DATA_REAL_TYPE value, cond_value;
825  public:
826  condition_expression(const shell_expression<A> & pcond, const shell_expression<B> & pleft, const shell_expression<C> & pright) : cond(pcond), left(pleft), right(pright)
827  {
828  cond_value = cond.GetValue();
829  value = cond_value >= 0.0 ? left.GetValue() : right.GetValue();
830  }
832  :cond(other.cond), left(other.left), right(other.right),
833  value(other.value), cond_value(other.cond_value) {}
834  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
836  {
837  if( cond_value >= 0.0 )
838  left.GetDerivative(mult,r);
839  else
840  right.GetDerivative(mult,r);
841  }
843  {
844  if( cond_value >= 0.0 )
845  left.GetDerivative(mult,r);
846  else
847  right.GetDerivative(mult,r);
848  }
849  };
850 
851  template<class A>
852  class stencil_expression : public shell_expression<stencil_expression<A> >
853  {
855  INMOST_DATA_REAL_TYPE value;
856  public:
857  stencil_expression(const dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 > & parg) : arg(parg)
858  {
859  value = 0.0;
860  for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
861  value += it->first * it->second.GetValue();
862  }
863  stencil_expression(const stencil_expression & other) : arg(other.arg), value(other.value) {}
864  __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
866  {
867  for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
868  it->second.GetDerivative(it->first*mult,r);
869  }
871  {
872  for(typename dynarray< std::pair<INMOST_DATA_REAL_TYPE, A >, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
873  it->second.GetDerivative(it->first*mult,r);
874  }
875  };
876 
877  __INLINE bool check_nans(INMOST_DATA_REAL_TYPE val) {return val != val;}
878  __INLINE bool check_nans(var_expression const & e) {return e.check_nans();}
879  __INLINE bool check_nans(multivar_expression const & e) {return e.check_nans();}
880 
883 }
884 
885 template<class A, class B, class C> __INLINE INMOST::condition_expression<A,B,C> condition(INMOST::shell_expression<A> const & control, INMOST::shell_expression<B> const & if_ge_zero, INMOST::shell_expression<C> const & if_lt_zero) { return INMOST::condition_expression<A,B,C>(control,if_ge_zero,if_lt_zero); }
886  __INLINE INMOST_DATA_REAL_TYPE condition(INMOST_DATA_REAL_TYPE control, INMOST_DATA_REAL_TYPE if_ge_zero, INMOST_DATA_REAL_TYPE if_lt_zero) {return control >= 0.0 ? if_ge_zero : if_lt_zero;}
896 template<class A> __INLINE INMOST_DATA_REAL_TYPE get_value(INMOST::shell_expression<A> const & Arg) { return Arg.GetValue(); }
906 template<class A, class B> __INLINE INMOST::pow_expression<A, B> pow(INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) { return INMOST::pow_expression<A, B> (Left, Right); }
908  __INLINE INMOST_DATA_REAL_TYPE soft_max(INMOST_DATA_REAL_TYPE Left, INMOST_DATA_REAL_TYPE Right, INMOST_DATA_REAL_TYPE tol) {return 0.5*(Left+Right+::sqrt((Left-Right)*(Left-Right)+tol*tol));}
910  __INLINE INMOST_DATA_REAL_TYPE soft_min(INMOST_DATA_REAL_TYPE Left, INMOST_DATA_REAL_TYPE Right, INMOST_DATA_REAL_TYPE tol) {return 0.5*(Left+Right-::sqrt((Left-Right)*(Left-Right)+tol*tol));}
921 template<class A, class B> __INLINE bool operator == (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() == Right.GetValue();}
922 template<class A, class B> __INLINE bool operator != (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() != Right.GetValue();}
923 template<class A, class B> __INLINE bool operator < (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() < Right.GetValue();}
924 template<class A, class B> __INLINE bool operator > (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() > Right.GetValue();}
925 template<class A, class B> __INLINE bool operator <= (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() <= Right.GetValue();}
926 template<class A, class B> __INLINE bool operator >= (INMOST::shell_expression<A> const & Left, INMOST::shell_expression<B> const & Right) {return Left.GetValue() >= Right.GetValue();}
927 template<class A> __INLINE bool operator == (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() == Right;}
928 template<class A> __INLINE bool operator != (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() != Right;}
929 template<class A> __INLINE bool operator < (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() < Right;}
930 template<class A> __INLINE bool operator > (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() > Right;}
931 template<class A> __INLINE bool operator <= (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() <= Right;}
932 template<class A> __INLINE bool operator >= (INMOST::shell_expression<A> const & Left, INMOST_DATA_REAL_TYPE Right) {return Left.GetValue() >= Right;}
933 template<class B> __INLINE bool operator == (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left == Right.GetValue();}
934 template<class B> __INLINE bool operator != (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left != Right.GetValue();}
935 template<class B> __INLINE bool operator < (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left < Right.GetValue();}
936 template<class B> __INLINE bool operator > (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left > Right.GetValue();}
937 template<class B> __INLINE bool operator <= (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left <= Right.GetValue();}
938 template<class B> __INLINE bool operator >= (INMOST_DATA_REAL_TYPE Left, INMOST::shell_expression<B> const & Right) {return Left >= Right.GetValue();}
939 
940 
941 
942 #endif
943 #endif
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
soft_max_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright, INMOST_DATA_REAL_TYPE tol)
__INLINE iterator begin()
Definition: container.hpp:1854
__INLINE INMOST::expr operator-(const INMOST_DATA_REAL_TYPE &left, const INMOST::expr &right)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE INMOST::unary_custom_variable< INMOST::abs_expression< typename A::Var >, A > fabs(INMOST::shell_dynamic_variable< typename A::Var, A > const &Arg)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE get_value(INMOST::shell_expression< A > const &Arg)
division_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
const_division_expression(const const_division_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
multivar_expression(INMOST_DATA_REAL_TYPE pvalue, Sparse::Row &pentries)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
stencil_expression(const dynarray< std::pair< INMOST_DATA_REAL_TYPE, A >, 64 > &parg)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
void Swap(Row &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE INMOST::soft_max_expression< A, B > soft_max(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right, INMOST_DATA_REAL_TYPE tol)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
virtual __INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
exp_expression(const exp_expression &b)
pow_const_expression(const shell_expression< A > &pleft, INMOST_DATA_REAL_TYPE pright)
__INLINE multivar_expression & operator/=(basic_expression const &expr)
__INLINE iterator end()
Definition: container.hpp:1855
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
Class to store the sparse matrix row.
Definition: inmost_sparse.h:90
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
addition_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST::expr operator+(const INMOST_DATA_REAL_TYPE &left, const INMOST::expr &right)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
cos_expression(const shell_expression< A > &parg)
var_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void SetValue(INMOST_DATA_REAL_TYPE val)
addition_expression(const addition_expression &other)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
#define INMOST_DATA_REAL_TYPE
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
virtual __INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
const_addition_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE padd)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
soft_abs_expression(const soft_abs_expression &b)
__INLINE INMOST::sqrt_expression< A > sqrt(INMOST::shell_expression< A > const &Arg)
sin_expression(const shell_expression< A > &parg)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
condition_expression(const shell_expression< A > &pcond, const shell_expression< B > &pleft, const shell_expression< C > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
soft_max_expression(const soft_max_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
variation_multiplication_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE pdmult)
void Clear()
Clear all data of the current row.
const_pow_expression(INMOST_DATA_REAL_TYPE pleft, const shell_expression< A > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
abs_expression(const shell_expression< A > &parg)
__INLINE INMOST::cos_expression< A > cos(INMOST::shell_expression< A > const &Arg)
__INLINE INMOST::soft_min_expression< A, B > soft_min(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right, INMOST_DATA_REAL_TYPE tol)
subtraction_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
log_expression(const shell_expression< A > &parg)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
var_expression unknown
__INLINE INMOST::expr operator/(const INMOST_DATA_REAL_TYPE &left, const INMOST::expr &right)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
multivar_expression(const multivar_expression &other)
unary_minus_expression(const shell_expression< A > &parg)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
const_multiplication_expression(const const_multiplication_expression &other)
abs_expression(const abs_expression &b)
const_subtraction_expression(const const_subtraction_expression &other)
__INLINE bool check_nans(INMOST_DATA_REAL_TYPE val)
soft_min_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright, INMOST_DATA_REAL_TYPE tol)
soft_min_expression(const soft_min_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE var_expression & operator=(var_expression const &other)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
Entries::iterator iterator
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
void Push(INMOST_DATA_ENUM_TYPE ind, INMOST_DATA_REAL_TYPE val)
__INLINE INMOST::sin_expression< A > sin(INMOST::shell_expression< A > const &Arg)
soft_sign_expression(const soft_sign_expression &b)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
var_expression(const var_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE multivar_expression & operator+=(basic_expression const &expr)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
soft_abs_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE tol)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
reciprocal_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE pdmult)
__INLINE bool operator!=(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right)
cos_expression(const cos_expression &b)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE INMOST::soft_sign_expression< A > soft_sign(INMOST::shell_expression< A > const &Arg, INMOST_DATA_REAL_TYPE tol)
#define __INLINE
Definition: inmost_common.h:75
condition_expression(const condition_expression &other)
soft_sign_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE tol)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
__INLINE const Sparse::Row & GetRow() const
virtual INMOST_DATA_REAL_TYPE GetValue() const =0
__INLINE INMOST::log_expression< A > log(INMOST::shell_expression< A > const &Arg)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE bool operator==(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
reciprocal_expression(const reciprocal_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
stencil_expression(const stencil_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
#define ENUMUNDEF
__INLINE INMOST::expr condition(const INMOST::expr &cond, const INMOST::expr &if_gt_zero, const INMOST::expr &if_le_zero)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
exp_expression(const shell_expression< A > &parg)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
multivar_expression(const basic_expression &expr)
#define INMOST_DATA_ENUM_TYPE
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
multivar_expression variable
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
multiplication_expression(const multiplication_expression &other)
const_division_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE pdmult)
__INLINE INMOST::abs_expression< A > abs(INMOST::shell_expression< A > const &Arg)
__INLINE INMOST::expr operator*(const INMOST_DATA_REAL_TYPE &left, const INMOST::expr &right)
__INLINE INMOST::exp_expression< A > exp(INMOST::shell_expression< A > const &Arg)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
multiplication_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
virtual __INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
const_pow_expression(const const_pow_expression &other)
Entries::const_iterator const_iterator
division_expression(const division_expression &other)
pow_const_expression(const pow_const_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE multivar_expression & operator*=(basic_expression const &expr)
sin_expression(const sin_expression &b)
sqrt_expression(const shell_expression< A > &parg)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE bool operator>=(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right)
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE multivar_expression & operator-=(basic_expression const &expr)
__INLINE INMOST::pow_expression< A, B > pow(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right)
__INLINE Sparse::Row & GetRow()
const_subtraction_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE pleft)
pow_expression(const shell_expression< A > &pleft, const shell_expression< B > &pright)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
multivar_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex, INMOST_DATA_REAL_TYPE pdmult=1.0)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
multivar_expression(INMOST_DATA_REAL_TYPE pvalue)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
subtraction_expression(const subtraction_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE bool operator>(INMOST::shell_expression< A > const &Left, INMOST::shell_expression< B > const &Right)
shell_expression(const shell_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
variation_multiplication_expression(const variation_multiplication_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE INMOST_DATA_REAL_TYPE GetValue() const
sqrt_expression(const sqrt_expression &b)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
__INLINE INMOST::soft_abs_expression< A > soft_abs(INMOST::shell_expression< A > const &Arg, INMOST_DATA_REAL_TYPE tol)
__INLINE multivar_expression & operator=(INMOST_DATA_REAL_TYPE pvalue)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
pow_expression(const pow_expression &other)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const
unary_minus_expression(const unary_minus_expression &b)
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row &r) const
virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger &r) const =0
log_expression(const log_expression &b)
const_multiplication_expression(const shell_expression< A > &parg, INMOST_DATA_REAL_TYPE pdmult)
__INLINE INMOST::variation_multiplication_expression< A > variation(INMOST::shell_expression< A > const &Arg, INMOST_DATA_REAL_TYPE Mult)
basic_expression(const basic_expression &other)
const_addition_expression(const const_addition_expression &other)