Boost logo

Ublas :

From: Russ (c.r.coggrave_at_[hidden])
Date: 2006-04-19 15:39:07

I have noticed that only some of the vector and matrix classes using the
sparse_tag container_type trait support the nnz() method. I am currently trying
to write a specialisation for vectors and matrices with the sparse_tag, but this
inconsitency prevents me from calling the nnz() method, and instead I must count
the non-zero elements by iterating over the container, which is hurting

Is there another trait that can be used to check for support of nnz(), or
alternatively, would it be possible to add nnz() to all vector and matrix
classes that use the sparse_tag container_type trait?

An example would be ublas::unit_vector<> class, which has the sparse_tag
container_type trait, but does not support nnz(). However, implementing nnz()
would of course be very simple.