Commit 90d82d5b authored by Kirill Terekhov's avatar Kirill Terekhov

Output nan and inf in matrix with Print; allow to get index of unknown

parent d2dcaa2b
......@@ -627,7 +627,11 @@ namespace INMOST
{
for(enumerator l = 0; l < Cols(); ++l)
{
if( fabs(get_value((*this)(k,l))) > threshold )
if( std::isinf(get_value((*this)(k,l))) )
std::cout << std::setw(12) << "inf";
else if( std::isnan(get_value((*this)(k,l))) )
std::cout << std::setw(12) << "nan";
else if( fabs(get_value((*this)(k,l))) > threshold )
std::cout << std::setw(12) << get_value((*this)(k,l));
else
std::cout << std::setw(12) << 0;
......
......@@ -96,6 +96,7 @@ namespace INMOST
var_expression(INMOST_DATA_REAL_TYPE pvalue, INMOST_DATA_ENUM_TYPE pindex) : value(pvalue), index(pindex) {}
__INLINE void SetValue(INMOST_DATA_REAL_TYPE val) { value = val; }
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
__INLINE INMOST_DATA_ENUM_TYPE GetIndex() const { return index; }
__INLINE void GetJacobian(INMOST_DATA_REAL_TYPE mult, Sparse::RowMerger & 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 void GetHessian(INMOST_DATA_REAL_TYPE multJ, Sparse::Row & J, INMOST_DATA_REAL_TYPE multH, Sparse::HessianRow & H) const {if( index != ENUMUNDEF ) J.Push(index,multJ); (void)multH; (void)H;}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment