[eigen] Test for a non-compiling cast |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Test for a non-compiling cast
- From: "Ricard Marxer Piñón" <email@xxxxxxxxxxxxxxxx>
- Date: Tue, 23 Dec 2008 04:48:28 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:x-google-sender-auth; bh=fwPg1xL2hHrf+w9yuYG4qUKtxhhzFfJmb1nu0LeVLdA=; b=ca0JqKfgzn5qRkl6hWwLHpkeSYvmgIEH8OD8JscfrkW2WfwzUiIwc698lYBHYY6abd 50q/4Smeuv7vM1iDF4Pp/jqJNPY740RmmxSSiRARqc3R0CkkEgT01eF7u/xLB4SOwmU8 UVBSqgfPKyDXSbNPV9Exja6q9oQsCOzdr+FnA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :x-google-sender-auth; b=uqcki/OtvgaeABCR8F854nnOKM5WQYT1ZlDPhxvNXSvAWUe0wga/HPu05zqO9F84Rr cLaeBKs+od7YOR2Kv+hqaCOlUlxO9ZH37OlhlTEWX2uCLBCkPZCIz8H5D32OMTqXLqS2 Cqn+oWxkBUtT7J39+dyZsT07MzYxhAVU7DJ0M=
Hi there,
I have problems with revision r900516 (I'm guessing since r900396).
I attach a test file.
--
ricard
http://www.ricardmarxer.com
http://www.caligraft.com
#include <Eigen/Core>
#include <cmath>
// import most common Eigen types
USING_PART_OF_NAMESPACE_EIGEN
// Type for the Real values
typedef float Real;
typedef std::complex< Real > Complex;
// Normally used matrices
typedef Eigen::Matrix< Real, Eigen::Dynamic,Eigen::Dynamic > MatrixXR;
typedef Eigen::Matrix< Complex, Eigen::Dynamic,Eigen::Dynamic > MatrixXC;
// this compiles
void test_no_template(MatrixXR a, MatrixXC* b){
(*b).block(0, 0, 3, 1) = a.block(0,0, 3, 1).cast<Complex>();
}
// this does not compile
template<class F>
void test_template(F a, MatrixXC* b){
(*b).block(0, 0, 3, 1) = a.block(0,0, 3, 1).cast<Complex>();
}
int main(int, char *[])
{
MatrixXR mr = MatrixXR::Zero(13, 10);
MatrixXC mc = MatrixXC::Ones(13, 10);
test_no_template(mr, &mc);
test_template<MatrixXR>(mr, &mc);
std::cout << "mc\n" << mc << std::endl;
}