Boost logo

Ublas :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2006-04-21 06:29:10


Michael Stevens wrote:

>> I would like to propose that we change the name of the nnz() members and
>> the corresponding free function (described by Gunter above) to
>> nnz_structural() to clarify its purpose, and create a new free function
>> called nnz() that iterates over the contains and returns the number of
>> elements != 0.
>
> All favour other then the renaming! I think we already once changed the name
> of the member function so I would be against doing it again. I recall the new
> name 'nnz' (as opposed to 'non_zeros') was chosen as it is used elsewhere for
> the number of structural non-zeros.
>

I think 'nnz' or 'number of non-zeros' is (almost ;-) universally
interpreted as being the number of /structural/ non-zeros. Thus IMHO the
nnz() function should not be renamed.

After all, I have never seen a dense matrix for instance having a nnz()
function (which would make sense IF we are interpreting it as numerical
non-zeros). Additionally, what is exactly a numerical-non-zero?
Tolerances come into play here.

Therefore I would keep the current nnz to be the structural nnz and
eventually provide a free function that can iterate over all elements of
a vector/matrix and compare each element to a reference-value (e.g. 0.0)
and to evaluate if it's in a given tolerance or not.

toon