Re: [eigen] triangular * scalar product? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] triangular * scalar product?
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 28 Oct 2011 22:29:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=wjaG8qgPmbwtH28od/BlVye3b3Y5CwLQn+rHbRYj14U=; b=TjRuT9zsUV2Eakz6TSmhqsuWc6477y1fEzdySW134zwF0h0wdTrVo89uI1OidckRLs b2dmVuaW/tX/UL0otTEH/oUOwfPDWfot0Hjdk3cjoMFb2Ep4L0UeJ8BxX68wJgeAefBa JjFubbV+ANwdbX3HDm37nXA4lW9lExh2SoPkM=
Indeed, there is no such operator, but that's very easy to add. In the
meantime you can do:
m2 = (m1*3).triangularView<Eigen::Upper>();
that's equivalent, and this is how we would implement it.
gael
On Fri, Oct 28, 2011 at 6:21 PM, Jim Bosch <talljimbo@xxxxxxxxx> wrote:
> It looks like triangularView doesn't support multiplication by scalars
> (except in-place). Is this just an oversight, or is there some reason
> implementation would be difficult?
>
> To be precise, the following does not compile:
>
> #include <Eigen/Core>
>
> int main() {
> Eigen::MatrixXd m1(5, 5);
> m1.setRandom();
> Eigen::MatrixXd m2(5, 5);
> m2 = m1.triangularView<Eigen::Upper>() * 3.0;
> }
>
> Thanks!
>
> Jim Bosch
>
>
>