00001 #include <complex>
00002 #include "TooN/regressions/regression.h"
00003 #include <TooN/internal/planar_complex.hh>
00004
00005 int main()
00006 {
00007 complex<double> i(0,1);
00008
00009 Vector<3, complex<double> > v1 = makeVector<complex<double> >(1.+i, 1.+2.*i, 3);
00010 Vector<3, complex<double> > v2 = makeVector<complex<double> >(1.-i, 1.-2.*i, 3);
00011
00012 cout << v2 * v1 << endl;
00013 cout << v2.as_diagonal() * v1 << endl;
00014
00015
00016 double re2[] = {1, 1, 3};
00017 double im2[] = {-1, -2, 0};
00018
00019 Vector<3, complex<double>, ReferencePlanarComplex> v2ish(make_pair(re2, im2));
00020 cout << v1 * v2ish << endl;
00021
00022 double real[] = {1,2,3,4};
00023 double imag[] = {5,6,7,8};
00024
00025
00026 Vector<4, complex<double>, ReferencePlanarComplex> vec(make_pair(real, imag));
00027
00028 cout << vec << endl;
00029 cout << vec.slice<1,3>() << endl;
00030 cout << vec.slice(2,2) << endl;
00031
00032 real[3] = 28;
00033 imag[3] = 10;
00034
00035 cout << vec << endl;
00036
00037
00038
00039 Matrix<4,4,complex<double> > A;
00040 A[0] = makeVector<complex<double> >(1.+i, 1.+6.*i, 3, 1.-i);
00041 A[1] = makeVector<complex<double> >(3.+6.i, 9.+2.*i, 4, 6.-1.*i);
00042 A[2] = makeVector<complex<double> >(1.+8.i, 2.*i, 2.-1.*i, 4.-1.*i);
00043 A[3] = makeVector<complex<double> >(2.+1.*i, 1.+3.*i, 1, 12.-5.*i);
00044
00045 cout << A;
00046 cout << A * vec<<endl;
00047 cout << A.T() ;
00048 cout << A * A ;
00049
00050 Vector<Dynamic, complex<double> > v3 = makeVector(1, 2, 3);
00051 cout << v3 << endl;
00052 cout << v3.size() << endl;
00053
00054 }