[mlpack-svn] [MLPACK] #173: Use row_iterator for arma_ostream_new::print()
MLPACK Trac
trac at coffeetalk-1.cc.gatech.edu
Wed Dec 7 16:01:25 EST 2011
#173: Use row_iterator for arma_ostream_new::print()
------------------------------+---------------------------------------------
Reporter: rcurtin | Owner: rcurtin
Type: enhancement | Status: new
Priority: trivial | Milestone:
Component: Armadillo Sparse | Keywords: armadillo row_iterator const_row_iterator arma_ostream print print_trans
Blocking: | Blocked By:
------------------------------+---------------------------------------------
From the code (arma_ostream_meat_new.hpp):
{{{
// An efficient row_iterator would make this simpler and faster
for(uword row=0; row < m_n_rows; ++row)
{
for(uword col=0; col < m_n_cols; ++col)
{
// the cell width appears to be reset after each element is
printed,
// hence we need to restore it
o.width(cell_width);
eT val = 0;
for(typename SpMat<eT>::const_iterator it = begin; it != end;
++it)
{
if(it != end && it.row == row && it.col == col)
{
val = *it;
break;
}
}
arma_ostream::print_elem(o,eT(val));
}
o << '\n';
}
}
}}}
Well, we have `SpMat<eT>::const_row_iterator` now, so we should use it.
--
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/173>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.
More information about the mlpack-svn
mailing list