Commit 890097ab authored by Kirill Terekhov's avatar Kirill Terekhov

sync with github

parents 1562b40b 949d38d0
......@@ -978,6 +978,7 @@ namespace INMOST
value = arg.GetValue()*dmult;
}
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, const A & parg) : arg(parg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1004,6 +1005,7 @@ namespace INMOST
value = arg.GetValue();
}
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, const A & parg) : arg(parg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1032,6 +1034,7 @@ namespace INMOST
value = arg.GetValue()*dmult;
}
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, const A & parg) : arg(parg), value(other.value), dmult(other.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1058,7 +1061,8 @@ namespace INMOST
value = arg.GetValue()+padd;
}
const_addition_expression(const const_addition_expression & other) : arg(other.arg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
const_addition_expression(const const_addition_expression & other, const A & parg) : arg(parg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult,r);
......@@ -1084,7 +1088,8 @@ namespace INMOST
value = pleft-arg.GetValue();
}
const_subtraction_expression(const const_subtraction_expression & other) : arg(other.arg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
const_subtraction_expression(const const_subtraction_expression & other, const A & parg) : arg(parg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(-mult,r);
......@@ -1114,6 +1119,8 @@ namespace INMOST
}
reciprocal_expression(const reciprocal_expression & other)
: arg(other.arg), value(other.value), reciprocial_val(other.reciprocial_val) {}
reciprocal_expression(const reciprocal_expression & other, const A & parg)
: arg(parg), value(other.value), reciprocial_val(other.reciprocial_val) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1142,7 +1149,8 @@ namespace INMOST
public:
unary_minus_expression(const shell_expression<A> & parg) : arg(parg) {value = -arg.GetValue();}
unary_minus_expression(const unary_minus_expression & b) : arg(b.arg) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
unary_minus_expression(const unary_minus_expression & b, const A & parg) : arg(parg) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(-mult,r);
......@@ -1165,7 +1173,8 @@ namespace INMOST
public:
unary_plus_expression(const shell_expression<A> & parg) : arg(parg) {value = arg.GetValue();}
unary_plus_expression(const unary_plus_expression & b) : arg(b.arg) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
unary_plus_expression(const unary_plus_expression & b, const A & parg) : arg(parg) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult,r);
......@@ -1193,7 +1202,8 @@ namespace INMOST
value = ::fabs(value);
}
abs_expression(const abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
abs_expression(const abs_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const {return value;}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian( (value == 0 ? (mult < 0.0 ? -1 : 1) : 1) * mult * dmult, r);
......@@ -1223,6 +1233,7 @@ namespace INMOST
value = ::exp(value);
}
exp_expression(const exp_expression & b) : arg(b.arg), value(b.value) {}
exp_expression(const exp_expression & b, const A & parg) : arg(parg), value(b.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1256,7 +1267,8 @@ namespace INMOST
value = ::log(value);
}
log_expression(const log_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
log_expression(const log_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult*dmult,r);
......@@ -1290,7 +1302,8 @@ namespace INMOST
value = ::sin(value);
}
sin_expression(const sin_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
sin_expression(const sin_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult*dmult,r);
......@@ -1324,7 +1337,8 @@ namespace INMOST
value = ::cos(value);
}
cos_expression(const cos_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
cos_expression(const cos_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult*dmult,r);
......@@ -1354,7 +1368,8 @@ namespace INMOST
value = ::sqrt(arg.GetValue());
}
sqrt_expression(const sqrt_expression & b) : arg(b.arg), value(b.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
sqrt_expression(const sqrt_expression & b, const A & parg) : arg(parg), value(b.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
if( value ) arg.GetJacobian(0.5*mult/value,r);
......@@ -1392,7 +1407,8 @@ namespace INMOST
dmult = lval/value;
}
soft_abs_expression(const soft_abs_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
soft_abs_expression(const soft_abs_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult*dmult,r);
......@@ -1422,7 +1438,8 @@ namespace INMOST
dmult = (1.0 - lval2/div)/sdiv;
}
soft_sign_expression(const soft_sign_expression & b) : arg(b.arg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
soft_sign_expression(const soft_sign_expression & b, const A & parg) : arg(parg), value(b.value), dmult(b.dmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; };
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
arg.GetJacobian(mult*dmult,r);
......@@ -1454,7 +1471,10 @@ namespace INMOST
}
soft_max_expression(const soft_max_expression & other)
: left(other.left), right(other.right), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
soft_max_expression(const soft_max_expression & other, const A & pleft, const B & pright)
: left(pleft), right(pright), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
left.GetJacobian(mult*ldmult,r);
......@@ -1488,6 +1508,8 @@ namespace INMOST
}
soft_min_expression(const soft_min_expression & other)
: left(other.left), right(other.right), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
soft_min_expression(const soft_min_expression & other, const A & pleft, const B & pright)
: left(pleft), right(pright), value(other.value), ldmult(other.ldmult), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1519,6 +1541,8 @@ namespace INMOST
}
multiplication_expression(const multiplication_expression & other)
: left(other.left), right(other.right), value(other.value) {}
multiplication_expression(const multiplication_expression & other, const A & pleft, const B & pright)
: left(pleft), right(pright), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1577,7 +1601,10 @@ namespace INMOST
}
}
division_expression(const division_expression & other) : left(other.left), right(other.right), value(other.value), reciprocal_rval(other.reciprocal_rval) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
division_expression(const division_expression & other, const A & pleft, const B & pright) :
left(pleft), right(pright), value(other.value), reciprocal_rval(other.reciprocal_rval) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
left.GetJacobian(mult * reciprocal_rval,r);
......@@ -1619,6 +1646,8 @@ namespace INMOST
}
addition_expression(const addition_expression & other)
: left(other.left), right(other.right), value(other.value) {}
addition_expression(const addition_expression & other, const A & pleft, const B & pright)
: left(pleft), right(pright), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1660,6 +1689,8 @@ namespace INMOST
}
subtraction_expression(const subtraction_expression & other)
: left(other.left), right(other.right),value(other.value) {}
subtraction_expression(const subtraction_expression & other, const A & pleft, const B & pright)
: left(pleft), right(pright),value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1709,6 +1740,9 @@ namespace INMOST
pow_expression(const pow_expression & other)
:left(other.left), right(other.right), value(other.value),
ldmult(other.ldmult), rdmult(other.rdmult) {}
pow_expression(const pow_expression & other, const A & pleft, const B & pright)
:left(pleft), right(pright), value(other.value),
ldmult(other.ldmult), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1745,6 +1779,9 @@ namespace INMOST
atan2_expression(const atan2_expression & other)
:left(other.left), right(other.right), value(other.value),
ldmult(other.ldmult), rdmult(other.rdmult) {}
atan2_expression(const atan2_expression & other, const A & pleft, const B & pright)
:left(pleft), right(pright), value(other.value),
ldmult(other.ldmult), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1782,6 +1819,8 @@ namespace INMOST
}
pow_const_expression(const pow_const_expression & other)
:left(other.left), value(other.value), ldmult(other.ldmult) {}
pow_const_expression(const pow_const_expression & other, const A & pleft)
:left(pleft), value(other.value), ldmult(other.ldmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1820,6 +1859,8 @@ namespace INMOST
}
const_pow_expression(const const_pow_expression & other)
:right(other.right), value(other.value), rdmult(other.rdmult) {}
const_pow_expression(const const_pow_expression & other, const A & pright)
:right(pright), value(other.value), rdmult(other.rdmult) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1851,6 +1892,9 @@ namespace INMOST
condition_expression(const condition_expression & other)
:cond(other.cond), left(other.left), right(other.right),
value(other.value), cond_value(other.cond_value) {}
condition_expression(const condition_expression & other, const A & pcond, const B & pleft, const C & pright)
:cond(pcond), left(pleft), right(pright),
value(other.value), cond_value(other.cond_value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1894,6 +1938,9 @@ namespace INMOST
branch_expression(const branch_expression & other)
:cond(other.cond), left(other.left), right(other.right),
value(other.value) {}
branch_expression(const branch_expression & other, bool pcond, const A & pleft, const B & pright)
:cond(pcond), left(pleft), right(pright),
value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
......@@ -1923,7 +1970,49 @@ namespace INMOST
}
};
template<class A>
class stencil_expression : public shell_expression<stencil_expression<A> >
{
dynarray< const_multiplication_expression<A>, 64 > arg;
INMOST_DATA_REAL_TYPE value;
public:
stencil_expression(const dynarray< const_multiplication_expression<A>, 64 > & parg) : arg(parg)
{
value = 0.0;
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
value += it->GetValue();
}
stencil_expression(const stencil_expression & other) : arg(other.arg), value(other.value) {}
stencil_expression(const stencil_expression & other, dynarray<const_multiplication_expression<A>,64> & parg) :
arg(parg), value(other.value) {}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const
{
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->GetJacobian(mult,r);
}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const
{
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
it->GetJacobian(mult,r);
}
__INLINE void GetHessian(INMOST_DATA_REAL_TYPE multJ, Sparse::Row & J, INMOST_DATA_REAL_TYPE multH, Sparse::HessianRow & H) const
{
Sparse::Row tmpJ, curJ;
Sparse::HessianRow tmpH, curH;
for(typename dynarray< const_multiplication_expression<A>, 64 >::iterator it = arg.begin(); it != arg.end(); ++it)
{
curJ.Clear();
curH.Clear();
it->GetHessian(multJ,curJ,multH,curH);
Sparse::Row::MergeSortedRows(1.0,curJ,1.0,J,tmpJ);
Sparse::HessianRow::MergeSortedRows(1.0,curH,1.0,H,tmpH);
J.Swap(tmpJ);
H.Swap(tmpH);
}
}
};
template<class A>
class function_expression : public shell_expression< function_expression<A> > {
const A &arg;
......@@ -1938,6 +2027,8 @@ namespace INMOST
function_expression(const function_expression &other)
: arg(other.arg), value(other.value), dmult(other.dmult), ddmult(other.ddmult) {}
function_expression(const function_expression &other, const A & parg)
: arg(parg), value(other.value), dmult(other.dmult), ddmult(other.ddmult) {}
function_expression &operator=(function_expression const &b)
{
......
......@@ -39,28 +39,14 @@ namespace INMOST
Op operand;
public:
unary_pool(const A & parg) : arg(parg), operand(arg) {}
unary_pool(const unary_pool & other) : arg(other.arg), operand(other.operand) {}
unary_pool & operator = (unary_pool const & other) {arg = other.arg; operand = other.operand; return * this;}
unary_pool(const unary_pool & other) : arg(other.arg), operand(other.operand,arg) {}
unary_pool & operator = (unary_pool const & other) {arg = other.arg; operand.assign(other.operand,arg); return * this;}
const shell_expression<A> & get_arg() {return arg;}
Op & get_op() {return operand;}
const Op & get_op() const {return operand;}
};
template<class Op, class A>
class unary_const_pool
{
A left;
INMOST_DATA_REAL_TYPE right;
Op operand;
public:
unary_const_pool(const A & pleft, INMOST_DATA_REAL_TYPE pright) : left(pleft), right(pright), operand(left,right) {}
unary_const_pool(const unary_const_pool & other) : left(other.left), right(other.right), operand(other.operand) {}
unary_const_pool & operator = (unary_const_pool const & other) {left = other.left; right = other.right; operand = other.operand; return * this;}
const shell_expression<A> & get_arg() {return left;}
Op & get_op() {return operand;}
const Op & get_op() const {return operand;}
};
template<class Op, class A, class B>
class binary_pool
......@@ -71,8 +57,8 @@ namespace INMOST
Op operand;
public:
binary_pool(const A & pleft, const B & pright) : left(pleft), right(pright), operand(left,right) {}
binary_pool(const binary_pool & other) : left(other.left), right(other.right), operand(other.operand) {}
binary_pool & operator =(binary_pool const & other) {left = other.left; right = other.right; operand = other.operand; return * this;}
binary_pool(const binary_pool & other) : left(other.left), right(other.right), operand(other.operand,left,right) {}
binary_pool & operator = (binary_pool const & other) {left = other.left; right = other.right; operand.assign(other.operand,left,right); return * this;}
const shell_expression<A> & get_left() {return left;}
const shell_expression<B> & get_right() {return right;}
Op & get_op() {return operand;}
......@@ -89,8 +75,8 @@ namespace INMOST
Op operand;
public:
ternary_pool(const A & pcond, const B & pleft, const C & pright) : cond(pcond), left(pleft), right(pright), operand(cond,left,right) {}
ternary_pool(const ternary_pool & other) : cond(other.cond), left(other.left), right(other.right), operand(other.operand) {}
ternary_pool & operator =(ternary_pool const & other) {cond = other.cond; left = other.left; right = other.right; operand = other.operand; return * this;}
ternary_pool(const ternary_pool & other) : cond(other.cond), left(other.left), right(other.right), operand(other.operand,cond,left,right) {}
ternary_pool & operator =(ternary_pool const & other) {cond = other.cond; left = other.left; right = other.right; operand.assign(other.operand,cond,left,right); return * this;}
const shell_expression<A> & get_cond() {return cond;}
const shell_expression<B> & get_left() {return left;}
const shell_expression<C> & get_right() {return right;}
......@@ -112,21 +98,7 @@ namespace INMOST
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {pool.get_op().GetJacobian(mult,r);}
__INLINE void GetHessian(INMOST_DATA_REAL_TYPE multJ, Sparse::Row & J, INMOST_DATA_REAL_TYPE multH, Sparse::HessianRow & H) const {pool.get_op().GetHessian(multJ,J,multH,H);}
};
template<class A, class ArgA>
class unary_const_pool_expression : public shell_expression<unary_const_pool_expression<A,ArgA> >
{
unary_const_pool<A,ArgA> pool;
public:
unary_const_pool_expression(const unary_const_pool<A,ArgA> & ppool) : pool(ppool) {}
unary_const_pool_expression(const unary_const_pool_expression & other) : pool(other.pool) {}
unary_const_pool_expression & operator = (unary_const_pool_expression const & other) {pool = other.pool; return * this;}
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return pool.get_op().GetValue(); }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & r) const {pool.get_op().GetJacobian(mult,r);}
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::Row & r) const {pool.get_op().GetJacobian(mult,r);}
__INLINE void GetHessian(INMOST_DATA_REAL_TYPE multJ, Sparse::Row & J, INMOST_DATA_REAL_TYPE multH, Sparse::HessianRow & H) const {pool.get_op().GetHessian(multJ,J,multH,H);}
};
template<class A, class ArgA, class ArgB>
class binary_pool_expression : public shell_expression<binary_pool_expression<A,ArgA,ArgB> >
{
......@@ -632,34 +604,7 @@ namespace INMOST
void GetVariation(const Storage & e, Sparse::RowMerger & r) const { (*this)[e].GetJacobian(1.0,r); }
abstract_dynamic_variable * Copy() const {return static_cast<abstract_dynamic_variable *>(new binary_custom_variable(*this));}
};
template<class Expr, class A>
class unary_const_custom_variable : public shell_dynamic_variable< unary_const_pool_expression<Expr, typename A::Var >,unary_const_custom_variable<Expr,A> >
{
private:
A Left;
INMOST_DATA_REAL_TYPE Right;
public:
unary_const_custom_variable(const shell_dynamic_variable<typename A::Var,A> & pleft, INMOST_DATA_REAL_TYPE pright)
: Left(pleft), Right(pright) {}
unary_const_custom_variable(const unary_const_custom_variable & other) : Left(other.Left), Right(other.Right) {}
unary_const_custom_variable & operator =(unary_const_custom_variable const & other) {Left = other.Left; Right = other.Right; return * this;}
INMOST_DATA_REAL_TYPE Value(const Storage & e) const {return (*this)[e].GetValue();}
multivar_expression Variable(const Storage & e) const
{
multivar_expression ret = (*this)[e];
return ret;
}
unary_const_pool_expression<Expr, typename A::Var > operator [](const Storage & e) const
{
unary_const_pool<Expr,typename A::Var> pool(Left[e],Right);
return unary_const_pool_expression<Expr, typename A::Var >(pool);
}
void GetVariation(const Storage & e, Sparse::Row & r) const { (*this)[e].GetJacobian(1.0,r); }
void GetVariation(const Storage & e, Sparse::RowMerger & r) const { (*this)[e].GetJacobian(1.0,r); }
abstract_dynamic_variable * Copy() const {return static_cast<abstract_dynamic_variable *>(new unary_const_custom_variable(*this));}
};
template<class Expr, class A, class B, class C>
class ternary_custom_variable : public shell_dynamic_variable< ternary_pool_expression<Expr, typename A::Var, typename B::Var, typename C::Var >,ternary_custom_variable<Expr,A,B,C> >
{
......@@ -701,22 +646,22 @@ template<class A> __INLINE INMO
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::sin_expression<typename A::Var>,A> sin(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::sin_expression<typename A::Var>,A>(Arg ); }
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::cos_expression<typename A::Var>,A> cos(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::cos_expression<typename A::Var>,A>(Arg); }
template<class A> __INLINE INMOST::unary_custom_variable<INMOST::sqrt_expression<typename A::Var>,A> sqrt(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg) { return INMOST::unary_custom_variable<INMOST::sqrt_expression<typename A::Var>,A>(Arg); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::variation_multiplication_expression<typename A::Var>,A> variation(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg, INMOST_DATA_REAL_TYPE Mult) {return INMOST::unary_const_custom_variable<INMOST::variation_multiplication_expression<typename A::Var>,A>(Arg,Mult);}
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::variation_multiplication_expression<typename A::Var>,A> variation(INMOST::shell_dynamic_variable<typename A::Var, A> const & Arg, INMOST_DATA_REAL_TYPE Mult) {return INMOST::unary_const_custom_variable<INMOST::variation_multiplication_expression<typename A::Var>,A>(Arg,Mult);}
template<class A, class B> __INLINE INMOST::binary_custom_variable<INMOST::addition_expression<typename A::Var,typename B::Var>,A, B> operator+(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::binary_custom_variable<INMOST::addition_expression<typename A::Var,typename B::Var>,A, B> (Left, Right); }
template<class A, class B> __INLINE INMOST::binary_custom_variable<INMOST::subtraction_expression<typename A::Var,typename B::Var>,A, B> operator-(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::binary_custom_variable<INMOST::subtraction_expression<typename A::Var,typename B::Var>, A, B> (Left, Right); }
template<class A, class B> __INLINE INMOST::binary_custom_variable<INMOST::multiplication_expression<typename A::Var,typename B::Var>,A, B> operator*(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::binary_custom_variable<INMOST::multiplication_expression<typename A::Var,typename B::Var>, A, B> (Left, Right); }
template<class A, class B> __INLINE INMOST::binary_custom_variable<INMOST::division_expression<typename A::Var,typename B::Var>,A, B> operator/(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::binary_custom_variable<INMOST::division_expression<typename A::Var,typename B::Var>, A, B> (Left, Right); }
template<class A, class B> __INLINE INMOST::binary_custom_variable<INMOST::pow_expression<typename A::Var,typename B::Var>,A, B> pow(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::binary_custom_variable<INMOST::pow_expression<typename A::Var,typename B::Var>,A, B>(Left, Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_pow_expression<typename B::Var>,B> pow(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_pow_expression<typename B::Var>,B>(Left, Right); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::pow_const_expression<typename A::Var>,A> pow(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::pow_const_expression<typename A::Var>,A>(Left, Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename B::Var>,B> operator*(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename B::Var>,B>(Right,Left); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename A::Var>,A> operator*(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename A::Var>,A>(Left,Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::reciprocal_expression<typename B::Var>,B> operator/(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::reciprocal_expression<typename B::Var>,B>(Right,Left); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_division_expression<typename A::Var>,A> operator/(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_division_expression<typename A::Var>,A>(Left, Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename B::Var>,B> operator+(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename B::Var>,B>(Right,Left); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator+(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left,Right); }
template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B> operator-(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B>(Right, Left); }
template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator-(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left, -Right); }
//template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_pow_expression<typename B::Var>,B> pow(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_pow_expression<typename B::Var>,B>(Left, Right); }
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::pow_const_expression<typename A::Var>,A> pow(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::pow_const_expression<typename A::Var>,A>(Left, Right); }
//template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename B::Var>,B> operator*(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename B::Var>,B>(Right,Left); }
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename A::Var>,A> operator*(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_multiplication_expression<typename A::Var>,A>(Left,Right); }
//template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::reciprocal_expression<typename B::Var>,B> operator/(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::reciprocal_expression<typename B::Var>,B>(Right,Left); }
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_division_expression<typename A::Var>,A> operator/(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_division_expression<typename A::Var>,A>(Left, Right); }
//template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename B::Var>,B> operator+(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename B::Var>,B>(Right,Left); }
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator+(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left,Right); }
//template<class B> __INLINE INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B> operator-(INMOST_DATA_REAL_TYPE Left, INMOST::shell_dynamic_variable<typename B::Var,B> const & Right) { return INMOST::unary_const_custom_variable<INMOST::const_subtraction_expression<typename B::Var>,B>(Right, Left); }
//template<class A> __INLINE INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A> operator-(INMOST::shell_dynamic_variable<typename A::Var,A> const & Left, INMOST_DATA_REAL_TYPE Right) { return INMOST::unary_const_custom_variable<INMOST::const_addition_expression<typename A::Var>,A>(Left, -Right); }
template<class A> __INLINE INMOST::stencil_variable<A> stencil(INMOST::Tag tag_elems, INMOST::Tag tag_coefs, INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg) { return INMOST::stencil_variable<A>(tag_elems,tag_coefs,Arg); }
template<class A> __INLINE INMOST::table_variable<A> get_table(INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg, const INMOST::keyval_table & Table) {return INMOST::table_variable<A>(Arg,Table);}
template<class A> __INLINE INMOST::stencil_expression<A> stencil(INMOST::HandleType * elems, INMOST_DATA_REAL_TYPE * coefs, INMOST_DATA_ENUM_TYPE num, INMOST::shell_dynamic_variable<typename A::Var,A> const & Arg)
......
......@@ -170,7 +170,7 @@ namespace INMOST
{
std::stringstream type(v->GetChild("Cells")->GetChildWithAttrib("Name", "types")->GetContents());
int ctype;
bool have_2d = false;
//bool have_2d = false;
for (int q = 0; q < ncells && grid_is_2d == 2; ++q)
{
type >> ctype;
......
......@@ -604,7 +604,7 @@ namespace INMOST
for(dynarray<HandleType,64>::size_type it = 0; it < nodes.size(); it++) //delete nodes inside the face
{
adj_type const & hc = m->HighConn(nodes[it]);
//adj_type const & hc = m->HighConn(nodes[it]);
if( m->GetMarker(nodes[it],rem) )
{
assert( m->HighConn(nodes[it]).empty() || m->Count(m->HighConn(nodes[it]).data(),static_cast<integer>(m->HighConn(nodes[it]).size()),hm) == 0 );
......
......@@ -4412,7 +4412,7 @@ namespace INMOST
time = Timer() - time;
REPORT_VAL("time",time);
#else //USE_MPI and USE_PARALLEL_STORAGE
(void) mask;
(void) ghost; (void) shared; (void) mask;
#endif //USE_MPI and USE_PARALLEL_STORAGE
EXIT_FUNC();
}
......
......@@ -62,6 +62,7 @@ namespace INMOST {
virtual INMOST_DATA_REAL_TYPE Condest(INMOST_DATA_REAL_TYPE tol, INMOST_DATA_ENUM_TYPE maxiter) {
throw INMOST::SolverUnsupportedOperation;
(void) tol; (void) maxiter;
};
virtual ~SolverInterface() {};
......
......@@ -8,15 +8,18 @@ namespace INMOST {
SolverInterface *SolverANI::Copy(const SolverInterface *other) {
throw INMOST::SolverUnsupportedOperation; //later
(void) other;
};
void SolverANI::Assign(const SolverInterface *other) {
throw INMOST::SolverUnsupportedOperation; //later
(void) other;
}
void SolverANI::Setup(int *argc, char ***argv, SolverParameters &p) {
solver.n = 0;
m.n = 0;
(void) argc; (void) argv; (void) p;
}
void SolverANI::SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) {
......
......@@ -13,11 +13,13 @@ namespace INMOST {
SolverInterface *SolverInner::Copy(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverInner::Assign(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverInner::Setup(int *argc, char ***argv, SolverParameters &p)
......@@ -42,7 +44,7 @@ namespace INMOST {
for (parameters_iterator_t parameter = p.parameters.begin(); parameter < p.parameters.end(); parameter++)
this->SetParameter((*parameter).first, (*parameter).second);
}
(void) argc; (void) argv;
}
bool SolverInner::Solve(Sparse::Vector &RHS, Sparse::Vector &SOL) {
......@@ -300,4 +302,4 @@ namespace INMOST {
this->Clear();
}
}
\ No newline at end of file
}
......@@ -20,6 +20,7 @@ namespace INMOST {
SolverDDPQILUC2::SolverDDPQILUC2(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverDDPQILUC2::SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) {
......
......@@ -18,6 +18,7 @@ namespace INMOST {
SolverILU2::SolverILU2(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverILU2::SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) {
......@@ -62,4 +63,4 @@ namespace INMOST {
}
}
\ No newline at end of file
}
......@@ -19,6 +19,7 @@ namespace INMOST {
SolverMPTILU2::SolverMPTILU2(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverMPTILU2::SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) {
......
......@@ -20,6 +20,7 @@ namespace INMOST {
SolverMPTILUC::SolverMPTILUC(const SolverInterface *other) {
//You should not really want to copy solver's information
throw INMOST::SolverUnsupportedOperation;
(void) other;
}
void SolverMPTILUC::SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) {
......
......@@ -598,6 +598,7 @@ public:
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_REAL_TYPE> LineValuesU(mobeg, moend,0.0), LineValuesL(mobeg,moend,0.0);
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE> LineIndecesU(mobeg, moend+1,UNDEF), LineIndecesL(mobeg,moend+1,UNDEF);
double tfactor = 0.0, tswap = 0.0, trescale = 0.0, treorder = 0.0, ttransversal = 0.0, treassamble = 0.0, ttotal, tt, testimator = 0.0, tlocal;
(void) tswap; //can be unused for some defines
#if defined(REORDER_METIS_ND)
double tmetisgraph = 0, tmetisnd = 0;
#endif
......@@ -1372,7 +1373,7 @@ public:
trcmorder = Timer();
std::fill(Ulist.begin() + wbeg - mobeg, Ulist.begin() + wend - mobeg, ENUMUNDEF);
//find node with the lowest order
INMOST_DATA_ENUM_TYPE start = wbeg;
//INMOST_DATA_ENUM_TYPE start = wbeg;
INMOST_DATA_ENUM_TYPE index = wbeg;
INMOST_DATA_ENUM_TYPE cur = ENUMUNDEF;
std::deque<INMOST_DATA_ENUM_TYPE> q;
......
......@@ -63,6 +63,7 @@ void MatrixInitDataPetsc(Mat **matrix, INMOST_MPI_Comm comm, const char *name)
*matrix = new Mat();
#if !defined(USE_MPI)
ierr = MatCreate(PETSC_COMM_WORLD, *matrix);
(void) comm;
#else
ierr = MatCreate(comm, *matrix);
#endif
......@@ -137,6 +138,7 @@ void VectorInitDataPetsc(Vec **vector, INMOST_MPI_Comm comm, const char *name)
*vector = new Vec();
#if !defined(USE_MPI)
ierr = VecCreate(PETSC_COMM_WORLD, *vector);
(void) comm;
#else
ierr = VecCreate(comm, *vector);
#endif
......@@ -214,6 +216,7 @@ void SolverInitDataPetsc(KSP **ksp, INMOST_MPI_Comm comm, const char *name)
*ksp = new KSP();