Re: [eigen] [Sparse] cwise op |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] [Sparse] cwise op
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 17 Nov 2010 10:27:25 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=+4q3whFycDrdoOpzRhDdvHFd9OZ+3IzaxfTzD44wlhM=; b=h9KBwfyGjmS19J8wlr+kZo3X21j9rqqLnxao6nvDEZjwRA5Dj6PIZggz7031yN7dJL 9yMUfQhM+faJYS7SHHESUX8bNd716iklZZGH7ExkzNsvJpvSIHj5SKxJMw09hxXos8sc 8Lq0XDVKn73YGBxoOgdX/m4eCs/t5/wuWdzc0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=kKKsIK7RBGdVJ3ARy7xAii2TSob/JEaVx9WNAa4NPhHkQTEeEoIjNFYqIaVcFnYPkP wJd387G8zs0kx1dlgHXetlawANnRVbS81Ih7Rqz5NdEZ6Qdd7UgPa2ymgJqRPBc8QVs/ OTKpTf0uHMQYd0a9eR/eKIFVulfEuV/5fC2ok=
Hi,
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...
gael
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
>
>
>