Re: [eigen] [Sparse] cwise op

[ Thread Index | Date Index | More Archives ]


this is already the default behavior, otherwise the result would be
dense, and that would make no sense to use a sparse representation.
That's also why there are currently only a very few cwise binary
operator exposed.

There is also one exception for coeff wise operator* for which we skip
each pair of elements where one is a zero. Currently, this is specific
to operator*, but using traits, we could extend it to operator &&  for
boolean matrices and perhaps a few others...


On Wed, Nov 17, 2010 at 9:54 AM,  <bernard.hugueney@xxxxxxxxxx> wrote:
> Hi,
> (and thank you Gael for the nice placement new tip for InnerIterator
> assignment !)
> I'd like to know if there is an efficient way to have Sparse coeffwise
> operator expressions where the result of the operator on
> the default value (0 or false) (for one and/or for both args on binary
> operators).
> For example, if I'd like to have a boolean sparse matrix storing which elts
> from sparse A are < than the corresponding element
> of sparse B, I don't think that
> A.binaryExpr(B, std::less<Scalar>())
> will be efficient because binaryExpr() has not been given the info that it
> is useless to perform the call when both operands have default value.
> Maybe some traits would express that the coeffwise operation has default
> result if arg1, arg2, arg1 & arg2 have default value ?
> What do you think ?
> Best regards,
> Bernard

Mail converted by MHonArc 2.6.19+