Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_NO_STATIC_ASSERT
00027 #define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them
00028 #endif
00029
00030 #ifndef EIGEN_DONT_VECTORIZE
00031 #define EIGEN_DONT_VECTORIZE // SSE intrinsics aren't designed to allow mixing types
00032 #endif
00033
00034 #include "main.h"
00035
00036
00037 template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
00038 {
00039 typedef Matrix<float, SizeAtCompileType, SizeAtCompileType> Mat_f;
00040 typedef Matrix<double, SizeAtCompileType, SizeAtCompileType> Mat_d;
00041 typedef Matrix<std::complex<float>, SizeAtCompileType, SizeAtCompileType> Mat_cf;
00042 typedef Matrix<std::complex<double>, SizeAtCompileType, SizeAtCompileType> Mat_cd;
00043 typedef Matrix<float, SizeAtCompileType, 1> Vec_f;
00044 typedef Matrix<double, SizeAtCompileType, 1> Vec_d;
00045 typedef Matrix<std::complex<float>, SizeAtCompileType, 1> Vec_cf;
00046 typedef Matrix<std::complex<double>, SizeAtCompileType, 1> Vec_cd;
00047
00048 Mat_f mf(size,size);
00049 Mat_d md(size,size);
00050 Mat_cf mcf(size,size);
00051 Mat_cd mcd(size,size);
00052 Vec_f vf(size,1);
00053 Vec_d vd(size,1);
00054 Vec_cf vcf(size,1);
00055 Vec_cd vcd(size,1);
00056
00057 mf+mf;
00058 VERIFY_RAISES_ASSERT(mf+md);
00059 VERIFY_RAISES_ASSERT(mf+mcf);
00060 VERIFY_RAISES_ASSERT(vf=vd);
00061 VERIFY_RAISES_ASSERT(vf+=vd);
00062 VERIFY_RAISES_ASSERT(mcd=md);
00063
00064 mf*mf;
00065 md*mcd;
00066 mcd*md;
00067 mf*vcf;
00068 mcf*vf;
00069 mcf *= mf;
00070 vcd = md*vcd;
00071 vcf = mcf*vf;
00072 #if 0
00073
00074 VERIFY_RAISES_ASSERT(mf*md);
00075 VERIFY_RAISES_ASSERT(mcf*mcd);
00076 VERIFY_RAISES_ASSERT(mcf*vcd);
00077 VERIFY_RAISES_ASSERT(vcf = mf*vf);
00078
00079 vf.eigen2_dot(vf);
00080 VERIFY_RAISES_ASSERT(vd.eigen2_dot(vf));
00081 VERIFY_RAISES_ASSERT(vcf.eigen2_dot(vf));
00082
00083 #endif
00084 }
00085
00086 void test_eigen2_mixingtypes()
00087 {
00088
00089 CALL_SUBTEST_1(mixingtypes<3>());
00090 CALL_SUBTEST_2(mixingtypes<4>());
00091 CALL_SUBTEST_3(mixingtypes<Dynamic>(20));
00092 }