Re: [eigen] Performing colwise norm() and squaredNorm() |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Performing colwise norm() and squaredNorm()
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 22 May 2010 19:17:03 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=6RwT9dAlR7T5h9pjm7xgGa/GGERVgOtshZufeYlIWzw=; b=HXYf17jG3eezPjK+x4O8P9hCoGB3es0LQfuYkCH5Ugodt0F/UNljOctfbql5DrdOSw FIf/617Jo0Qh6r98CSLb0kFRZumH+2tQrRMDeuyOD+4mUVeYslXY1loxA1cDxHsQnYsb HLof/hcYZ2U+XyFwjmt9sWztjVdtgCCxXTbog=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=VrOnhDjwVX5gIv63m1EqZWtJCIHtX0U9yaWSN+kpVqV50kfbUNa2s3DxP7Ma2JBieQ Pm/TXlkGCrjG9VchhbgG7bodTTblNC5aCyFo/a5bpvnpb62VvC0hI3r6t4AmbIRu0mNn xu+ocNb6WR9MMbcSQk7ySlxX5EJE9jzu++mjU=
This should compile. I confirm it errors out. This is a bug. Can you
please file a bug so we don't forget about it.
Indeed, squaredNorm() should return an expression with the RealScalar type.
meanwhile you can work around this bug by adding .real()
Benoit
2010/5/22 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
> Hi,
>
> In the following program, I try to compute the squaredNorm of each column
> of a complex-double matrix. The result should be a vector of doubles which
> should be assignable to a vector of doubles. It seems Eigen sets the type of
> the temporary to be complex-double and indicates that I am illegally mixing
> different types. Is this by design?
>
>
>
> int main(void)
> {
> int const N = 5;
> MatrixXcd M(N,N);
> M.setRandom();
> VectorXd v(N);
> v.setZero();
> v += M.colwise().squaredNorm(); // <-- ERROR: mixing types
> // also with norm()
> return 0;
> }
>
>
> Thanks,
> Manoj
>
>
>