Exemplo n.º 1
0
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;
  }
}
Exemplo n.º 2
0
 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];
 }
Exemplo n.º 3
0
 static Uint size(const RowT& self)
 {
   return self.size();
 }
Exemplo n.º 4
0
 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];
 }
Exemplo n.º 5
0
 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;
 }