|
Ublas : |
Subject: Re: [ublas] Sparse matrices can contain zeroes
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2011-02-18 12:24:33
Alex Hagen-Zanker wrote:
> From the documentation it seems that sparse matrices only contain
> non-zero values and that iterators can be used to iterate over all
> non-zero values.
>
> I found however that assigning the value 0 to an element puts it into
> the matrix and causes iterators to iterate over it.
>
> Am I doing / seeing something wrong?
I guess for sparse matrices, there are two types of zeros: structural zeros and ordinary zeros. If we are talking about the non-zero elements of a sparse matrix, we mean the structural non-zero elements, not the set of matrix elements whose values happen to be different from zero.
Of course it may happen that a structural non-zero element of a matrix gets assigned the value 0, but this doesn't turn it into a structural zero element.
Regards,
Thomas