diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-06-23 14:27:20 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-06-23 14:27:20 +0200 |
commit | 76faf4a9657efeed089aeedc98a769410c32d3d7 (patch) | |
tree | bbfe9d39d8e12ae5cd90ac8cbcb69a54ae81c953 /test/mixingtypes.cpp | |
parent | 67c12531e567629e84713fbb3150560c916bd08c (diff) |
Introduce a NumTraits<T>::Literal type to be used for literals, and
improve mixing type support in operations between arrays and scalars:
- 2 * ArrayXcf is now optimized in the sense that the integer 2 is properly promoted to a float instead of a complex<float> (fix a regression)
- 2.1 * ArrayXi is now forbiden (previously, 2.1 was converted to 2)
- This mechanism should be applicable to any custom scalar type, assuming NumTraits<T>::Literal is properly defined (it defaults to T)
Diffstat (limited to 'test/mixingtypes.cpp')
-rw-r--r-- | test/mixingtypes.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp index fe8c16470..57ef85c32 100644 --- a/test/mixingtypes.cpp +++ b/test/mixingtypes.cpp @@ -79,6 +79,11 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) VERIFY_MIX_SCALAR(vf * scf , vf.template cast<complex<float> >() * scf); VERIFY_MIX_SCALAR(scd * vd , scd * vd.template cast<complex<double> >()); + VERIFY_MIX_SCALAR(vcf * 2 , vcf * complex<float>(2)); + VERIFY_MIX_SCALAR(vcf * 2.1 , vcf * complex<float>(2.1)); + VERIFY_MIX_SCALAR(2 * vcf, vcf * complex<float>(2)); + VERIFY_MIX_SCALAR(2.1 * vcf , vcf * complex<float>(2.1)); + // check scalar quotients VERIFY_MIX_SCALAR(vcf / sf , vcf / complex<float>(sf)); VERIFY_MIX_SCALAR(vf / scf , vf.template cast<complex<float> >() / scf); |