
Ublas : 
Subject: Re: [ublas] Sparse matrices can contain zeroes
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 20110218 12:24:33
Alex HagenZanker wrote:
> From the documentation it seems that sparse matrices only contain
> nonzero values and that iterators can be used to iterate over all
> nonzero 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 nonzero elements of a sparse matrix, we mean the structural nonzero elements, not the set of matrix elements whose values happen to be different from zero.
Of course it may happen that a structural nonzero element of a matrix gets assigned the value 0, but this doesn't turn it into a structural zero element.
Regards,
Thomas