void SparseMatrixTemplate_RM<T>::eraseZeros(T zeroTol) { for(size_t i=0;i<rows.size();i++) { RowT temp; temp.n = n; typename RowT::const_iterator j; for(j=rows[i].begin();j!=rows[i].end();j++) if(Abs(j->second) > Abs(zeroTol)) temp.insert(j->first,j->second); rows[i].entries.clear(); rows[i] = temp; } }
void to_vector(RealVector& result, const RowT& row) { const Uint row_size = row.size(); cf3_assert(result.size() >= row_size); for(Uint i =0; i != row_size; ++i) result[i] = row[i]; }
static Uint size(const RowT& self) { return self.size(); }
static ValueT get_item(RowT& self, const Uint i) { if(i >= self.size()) throw common::BadValue(FromHere(), "Index " + boost::lexical_cast<std::string>(i) + " is out of range for Table row of size " + boost::lexical_cast<std::string>(self.size())); return self[i]; }
static void set_item(RowT& self, const Uint i, const ValueT value) { if(i >= self.size()) throw common::BadValue(FromHere(), "Index " + boost::lexical_cast<std::string>(i) + " is out of range for Table row of size " + boost::lexical_cast<std::string>(self.size())); self[i] = value; }