Commit 217fbf88 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

Synchronize

Renamed GetDerivative to GetJacobian
parent a2d5243c
...@@ -22,7 +22,7 @@ namespace INMOST ...@@ -22,7 +22,7 @@ namespace INMOST
void FromBasicExpression(Sparse::Row & entries, const basic_expression & expr) void FromBasicExpression(Sparse::Row & entries, const basic_expression & expr)
{ {
Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger(); Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger();
expr.GetDerivative(1.0,merger); expr.GetJacobian(1.0,merger);
merger.RetriveRow(entries); merger.RetriveRow(entries);
merger.Clear(); merger.Clear();
} }
...@@ -31,15 +31,15 @@ namespace INMOST ...@@ -31,15 +31,15 @@ namespace INMOST
{ {
Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger(); Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger();
merger.PushRow(multme,entries); merger.PushRow(multme,entries);
expr.GetDerivative(multit,merger); expr.GetJacobian(multit,merger);
merger.RetriveRow(entries); merger.RetriveRow(entries);
merger.Clear(); merger.Clear();
} }
void FromGetDerivative(const basic_expression & expr, INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) void FromGetJacobian(const basic_expression & expr, INMOST_DATA_REAL_TYPE mult, Sparse::Row & r)
{ {
Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger(); Sparse::RowMerger & merger = Automatizator::GetCurrent()->GetMerger();
expr.GetDerivative(mult,merger); expr.GetJacobian(mult,merger);
merger.AddRow(1.0,r); merger.AddRow(1.0,r);
merger.RetriveRow(r); merger.RetriveRow(r);
merger.Clear(); merger.Clear();
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#if defined(USE_AUTODIFF) #if defined(USE_AUTODIFF)
namespace INMOST namespace INMOST
{ {
class basic_expression class basic_expression
{ {
...@@ -32,15 +31,17 @@ namespace INMOST ...@@ -32,15 +31,17 @@ namespace INMOST
basic_expression() {}//if( GetAutodiffPrint() ) std::cout << this << " Created" << std::endl;} basic_expression() {}//if( GetAutodiffPrint() ) std::cout << this << " Created" << std::endl;}
basic_expression(const basic_expression & other) {};//std::cout << this << " Created from " << &other << std::endl;} basic_expression(const basic_expression & other) {};//std::cout << this << " Created from " << &other << std::endl;}
virtual INMOST_DATA_REAL_TYPE GetValue() const = 0; virtual INMOST_DATA_REAL_TYPE GetValue() const = 0;
virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const = 0; virtual void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const = 0;
virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const = 0; virtual void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const = 0;
//virtual void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const = 0;
//virtual void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const = 0;
virtual ~basic_expression() {}//if( GetAutodiffPrint() ) std::cout << this << " Destroied" << std::endl;} virtual ~basic_expression() {}//if( GetAutodiffPrint() ) std::cout << this << " Destroied" << std::endl;}
}; };
bool CheckCurrentAutomatizator(); bool CheckCurrentAutomatizator();
void FromBasicExpression(Sparse::Row & entries, const basic_expression & expr); void FromBasicExpression(Sparse::Row & entries, const basic_expression & expr);
void AddBasicExpression(Sparse::Row & entries, INMOST_DATA_REAL_TYPE multme, INMOST_DATA_REAL_TYPE multit, const basic_expression & expr); void AddBasicExpression(Sparse::Row & entries, INMOST_DATA_REAL_TYPE multme, INMOST_DATA_REAL_TYPE multit, const basic_expression & expr);
void FromGetDerivative(const basic_expression & expr, INMOST_DATA_REAL_TYPE mult, Sparse::Row & r); void FromGetJacobian(const basic_expression & expr, INMOST_DATA_REAL_TYPE mult, Sparse::Row & r);
//bool GetAutodiffPrint(); //bool GetAutodiffPrint();
//void SetAutodiffPrint(bool set); //void SetAutodiffPrint(bool set);
...@@ -51,8 +52,10 @@ namespace INMOST ...@@ -51,8 +52,10 @@ namespace INMOST
shell_expression() {}// if( GetAutodiffPrint() ) std::cout << this << " Shell Created for " << dynamic_cast<basic_expression *>(this) << std::endl;} shell_expression() {}// if( GetAutodiffPrint() ) std::cout << this << " Shell Created for " << dynamic_cast<basic_expression *>(this) << std::endl;}
shell_expression(const shell_expression & other) {}//std::cout << this << " Shell Created from " << &other << std::endl;} shell_expression(const shell_expression & other) {}//std::cout << this << " Shell Created from " << &other << std::endl;}
__INLINE virtual INMOST_DATA_REAL_TYPE GetValue() const {return static_cast<const Derived *>(this)->GetValue(); } __INLINE virtual INMOST_DATA_REAL_TYPE GetValue() const {return static_cast<const Derived *>(this)->GetValue(); }
__INLINE virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const { return static_cast<const Derived *>(this)->GetDerivative(mult,r); } __INLINE virtual void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const { return static_cast<const Derived *>(this)->GetJacobian(mult,r); }
__INLINE virtual void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const { return static_cast<const Derived *>(this)->GetDerivative(mult,r); } __INLINE virtual void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const { return static_cast<const Derived *>(this)->GetJacobian(mult,r); }
//__INLINE virtual void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {return static_cast<const Derived *>(this)->GetHessian(mult,r); }
//__INLINE virtual void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {return static_cast<const Derived *>(this)->GetHessian(mult,r); }
operator Derived & () {return *static_cast<Derived *>(this);} operator Derived & () {return *static_cast<Derived *>(this);}
operator const Derived & () const {return *static_cast<const Derived *>(this);} operator const Derived & () const {return *static_cast<const Derived *>(this);}
~shell_expression() {}// if( GetAutodiffPrint() ) std::cout << this << " Shell Destroied for " << dynamic_cast<basic_expression *>(this) << std::endl;} ~shell_expression() {}// if( GetAutodiffPrint() ) std::cout << this << " Shell Destroied for " << dynamic_cast<basic_expression *>(this) << std::endl;}
...@@ -68,8 +71,10 @@ namespace INMOST ...@@ -68,8 +71,10 @@ namespace INMOST
const_expression(const const_expression & other) :value(other.value) {} const_expression(const const_expression & other) :value(other.value) {}
const_expression(INMOST_DATA_REAL_TYPE pvalue) : value(pvalue) {} const_expression(INMOST_DATA_REAL_TYPE pvalue) : value(pvalue) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {} __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {}
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {} __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {}
//__INLINE void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {}
//__INLINE void GetHessian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {}
__INLINE const_expression & operator =(const_expression const & other) __INLINE const_expression & operator =(const_expression const & other)
{ {
value = other.value; value = other.value;
...@@ -86,8 +91,8 @@ namespace INMOST ...@@ -86,8 +91,8 @@ namespace INMOST
var_expression(const var_expression & other) :value(other.value), index(other.index) {} var_expression(const var_expression & other) :value(other.value), index(other.index) {}
var_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex) : value(pvalue), index(pindex) {} var_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex) : value(pvalue), index(pindex) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {if( index != ENUMUNDEF ) r[index] += mult;} __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {if( index != ENUMUNDEF ) r[index] += mult;}
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {if( index != ENUMUNDEF ) r[index] += mult;} __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {if( index != ENUMUNDEF ) r[index] += mult;}
__INLINE var_expression & operator =(var_expression const & other) __INLINE var_expression & operator =(var_expression const & other)
{ {
value = other.value; value = other.value;
...@@ -121,19 +126,19 @@ namespace INMOST ...@@ -121,19 +126,19 @@ namespace INMOST
value = expr.GetValue(); value = expr.GetValue();
if( CheckCurrentAutomatizator() ) if( CheckCurrentAutomatizator() )
FromBasicExpression(entries,expr); //Optimized version FromBasicExpression(entries,expr); //Optimized version
else expr.GetDerivative(1.0,entries); else expr.GetJacobian(1.0,entries);
} }
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; } __INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it) for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it)
r[it->first] += it->second*mult; r[it->first] += it->second*mult;
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
if( CheckCurrentAutomatizator() ) if( CheckCurrentAutomatizator() )
FromGetDerivative(*this,mult,r); FromGetJacobian(*this,mult,r);
else else
{ {
for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it) for(Sparse::Row::const_iterator it = entries.Begin(); it != entries.End(); ++it)
...@@ -154,7 +159,7 @@ namespace INMOST ...@@ -154,7 +159,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp; Sparse::Row tmp;
expr.GetDerivative(1.0,tmp); expr.GetJacobian(1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -175,7 +180,7 @@ namespace INMOST ...@@ -175,7 +180,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
expr.GetDerivative(1.0,tmp); expr.GetJacobian(1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -188,7 +193,7 @@ namespace INMOST ...@@ -188,7 +193,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
expr.GetDerivative(-1.0,tmp); expr.GetJacobian(-1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -202,7 +207,7 @@ namespace INMOST ...@@ -202,7 +207,7 @@ namespace INMOST
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= rval; for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= rval;
expr.GetDerivative(lval,tmp); expr.GetJacobian(lval,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
value *= rval; value *= rval;
...@@ -219,7 +224,7 @@ namespace INMOST ...@@ -219,7 +224,7 @@ namespace INMOST
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= reciprocial_rval; for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= reciprocial_rval;
expr.GetDerivative(-value*reciprocial_rval,tmp); expr.GetJacobian(-value*reciprocial_rval,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -321,16 +326,16 @@ namespace INMOST ...@@ -321,16 +326,16 @@ namespace INMOST
/// Set value without changing derivatives /// Set value without changing derivatives
__INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; } __INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; }
/// Retrive derivatives with multiplier into Sparse::RowMerger structure. /// Retrive derivatives with multiplier into Sparse::RowMerger structure.
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it) for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it)
r[it->first] += it->second*mult; r[it->first] += it->second*mult;
} }
/// Retrive derivatives with multiplier into Sparse::Row structure. /// Retrive derivatives with multiplier into Sparse::Row structure.
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
if( CheckCurrentAutomatizator() ) if( CheckCurrentAutomatizator() )
FromGetDerivative(*this,mult,r); FromGetJacobian(*this,mult,r);
else else
{ {
for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it) for(Sparse::Row::iterator it = entries.Begin(); it != entries.End(); ++it)
...@@ -351,7 +356,7 @@ namespace INMOST ...@@ -351,7 +356,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp; Sparse::Row tmp;
expr.GetDerivative(1.0,tmp); expr.GetJacobian(1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -378,7 +383,7 @@ namespace INMOST ...@@ -378,7 +383,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
expr.GetDerivative(1.0,tmp); expr.GetJacobian(1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -391,7 +396,7 @@ namespace INMOST ...@@ -391,7 +396,7 @@ namespace INMOST
else else
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
expr.GetDerivative(-1.0,tmp); expr.GetJacobian(-1.0,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -405,7 +410,7 @@ namespace INMOST ...@@ -405,7 +410,7 @@ namespace INMOST
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= rval; for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= rval;
expr.GetDerivative(lval,tmp); expr.GetJacobian(lval,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
value *= rval; value *= rval;
...@@ -422,7 +427,7 @@ namespace INMOST ...@@ -422,7 +427,7 @@ namespace INMOST
{ {
Sparse::Row tmp(entries); Sparse::Row tmp(entries);
for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= reciprocial_rval; for(Sparse::Row::iterator it = tmp.Begin(); it != tmp.End(); ++it) it->second *= reciprocial_rval;
expr.GetDerivative(-value*reciprocial_rval,tmp); expr.GetJacobian(-value*reciprocial_rval,tmp);
entries.Swap(tmp); entries.Swap(tmp);
} }
return *this; return *this;
...@@ -471,13 +476,13 @@ namespace INMOST ...@@ -471,13 +476,13 @@ namespace INMOST
} }
const_multiplication_expression(const const_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {} const_multiplication_expression(const const_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
}; };
...@@ -493,13 +498,13 @@ namespace INMOST ...@@ -493,13 +498,13 @@ namespace INMOST
} }
variation_multiplication_expression(const variation_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {} variation_multiplication_expression(const variation_multiplication_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
}; };
...@@ -517,13 +522,13 @@ namespace INMOST ...@@ -517,13 +522,13 @@ namespace INMOST
} }
const_division_expression(const const_division_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {} const_division_expression(const const_division_expression & other) : arg(other.arg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
}; };
...@@ -539,13 +544,13 @@ namespace INMOST ...@@ -539,13 +544,13 @@ namespace INMOST
} }
const_addition_expression(const const_addition_expression & other) : arg(other.arg), value(other.value) {} const_addition_expression(const const_addition_expression & other) : arg(other.arg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult,r); arg.GetJacobian(mult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(mult,r); arg.GetJacobian(mult,r);
} }
}; };
...@@ -561,13 +566,13 @@ namespace INMOST ...@@ -561,13 +566,13 @@ namespace INMOST
} }
const_subtraction_expression(const const_subtraction_expression & other) : arg(other.arg), value(other.value) {} const_subtraction_expression(const const_subtraction_expression & other) : arg(other.arg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(-mult,r); arg.GetJacobian(-mult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(-mult,r); arg.GetJacobian(-mult,r);
} }
}; };
...@@ -586,13 +591,13 @@ namespace INMOST ...@@ -586,13 +591,13 @@ namespace INMOST
reciprocal_expression(const reciprocal_expression & other) reciprocal_expression(const reciprocal_expression & other)
: arg(other.arg), value(other.value), reciprocial_val(other.reciprocial_val) {} : arg(other.arg), value(other.value), reciprocial_val(other.reciprocial_val) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; } __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(-mult*value*reciprocial_val,r); arg.GetJacobian(-mult*value*reciprocial_val,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(-mult*value*reciprocial_val,r); arg.GetJacobian(-mult*value*reciprocial_val,r);
} }
}; };
...@@ -605,13 +610,13 @@ namespace INMOST ...@@ -605,13 +610,13 @@ namespace INMOST
unary_minus_expression(const shell_expression<A> & parg) : arg(parg) {value = -arg.GetValue();} unary_minus_expression(const shell_expression<A> & parg) : arg(parg) {value = -arg.GetValue();}
unary_minus_expression(const unary_minus_expression & b) : arg(b.arg) {} unary_minus_expression(const unary_minus_expression & b) : arg(b.arg) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;} __INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(-mult,r); arg.GetJacobian(-mult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(-mult,r); arg.GetJacobian(-mult,r);
} }
}; };
...@@ -629,13 +634,13 @@ namespace INMOST ...@@ -629,13 +634,13 @@ namespace INMOST
} }
abs_expression(const abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {} abs_expression(const abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;} __INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative( mult * dmult, r); arg.GetJacobian( mult * dmult, r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative( mult * dmult, r); arg.GetJacobian( mult * dmult, r);
} }
}; };
...@@ -652,13 +657,13 @@ namespace INMOST ...@@ -652,13 +657,13 @@ namespace INMOST
} }
exp_expression(const exp_expression & b) : arg(b.arg), value(b.value) {} exp_expression(const exp_expression & b) : arg(b.arg), value(b.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }; __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative( mult * value, r); arg.GetJacobian( mult * value, r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative( mult * value, r); arg.GetJacobian( mult * value, r);
} }
}; };
...@@ -676,13 +681,13 @@ namespace INMOST ...@@ -676,13 +681,13 @@ namespace INMOST
} }
log_expression(const log_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {} log_expression(const log_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }; __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
} }
}; };
...@@ -701,13 +706,13 @@ namespace INMOST ...@@ -701,13 +706,13 @@ namespace INMOST
} }
sin_expression(const sin_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {} sin_expression(const sin_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }; __INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetDerivative(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const __INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{ {
arg.GetDerivative(mult*dmult,r); arg.GetJacobian(mult*dmult,r);
}