Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-05-29 04:19:59


Luca,

On Saturday 28 May 2005 22:32, luca regini wrote:
> I know of Gunter Winkler's page about ublas hints and tricks. Sadly my
> Visual Studio 7.1 compiler refuese to compile the examples that are
> found on its website.

Oh Gunters VC7.1 version does look rather wrong. The following corrected
version should help out.

void gunter_example ()
{
     typedef boost::numeric::ublas::sparse_matrix<double> Matr;
     Matr a;
     // .... fill matrix
     // iterate over non-zero elements
     for ( Matr::iterator1 it1 = a.begin1(); it1 != a.end1(); ++it1 )
#ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION
    for ( Matr::iterator2 it2 = it1.begin(); it2 != it1.end(); ++it2 )
#else
    for ( Matr::iterator2 it2 = begin(it1, ublas::iterator1_tag()); it2 !=
end(it1, ublas::iterator1_tag()); ++it2 )
#endif
         *it1 = 0.;
}

Gunter any chance of correcting the web site.

Michael