E
eric
Dear c++ experts(I am using g++4.6.1)
I have the following code segment
---------
matrix<std::complex<double> > m1(2, 1);
matrix<std::complex<double> > m2(1, 2);
kmatrix<std::complex<double> , 2, 2> m3;
m3 = 0;
m1[0][0] = (1.1, 1.1, 3.4); m1[1][0] = (2.2, 2.2);
m2[0][0] = (3.1, 3.3, 1.9); m2[0][1] = (4.4, 4.4);
cout << "m1[00] = " << m1[0][0] << endl;
cout << "m2[00] = " << m2[0][0] << endl;
----------------------------------------------------
that (1.1, 1.1, 3.4) is not valid complex number, but I did not get
any compile error, but it run (badly)
----------
m1[00] = (3.4,0)
m2[00] = (1.9,0)
m1[00] + m2[00] = (5.3,0)
--------------------------------------------
it look insert that last number in (1.1, 1.1, 3.4) into real part and
always put 0 to imaginary part of my matrix
element which I already claim/declare as std::complex<double>
I am not 100% sure this template type be correctly propagate to
matrix.hpp (and its element valarray)
actually, even I enter correct complex number format, like m1[0]
[0]=(1.1, 1.1), m2[0][0]=(3.1, 3.3)
the output still is
m1[00]=(1.1,0)
m2[00]=(3.3,0)
just like previous example, put last number as real part and always
put 0 to imaginary part of my matrix element
plz help, and thanks a lot in advance, Eric
where go wrong such I can not get the same complex number I input into
my matrix element?
I have the following code segment
---------
matrix<std::complex<double> > m1(2, 1);
matrix<std::complex<double> > m2(1, 2);
kmatrix<std::complex<double> , 2, 2> m3;
m3 = 0;
m1[0][0] = (1.1, 1.1, 3.4); m1[1][0] = (2.2, 2.2);
m2[0][0] = (3.1, 3.3, 1.9); m2[0][1] = (4.4, 4.4);
cout << "m1[00] = " << m1[0][0] << endl;
cout << "m2[00] = " << m2[0][0] << endl;
----------------------------------------------------
that (1.1, 1.1, 3.4) is not valid complex number, but I did not get
any compile error, but it run (badly)
----------
m1[00] = (3.4,0)
m2[00] = (1.9,0)
m1[00] + m2[00] = (5.3,0)
--------------------------------------------
it look insert that last number in (1.1, 1.1, 3.4) into real part and
always put 0 to imaginary part of my matrix
element which I already claim/declare as std::complex<double>
I am not 100% sure this template type be correctly propagate to
matrix.hpp (and its element valarray)
actually, even I enter correct complex number format, like m1[0]
[0]=(1.1, 1.1), m2[0][0]=(3.1, 3.3)
the output still is
m1[00]=(1.1,0)
m2[00]=(3.3,0)
just like previous example, put last number as real part and always
put 0 to imaginary part of my matrix element
plz help, and thanks a lot in advance, Eric
where go wrong such I can not get the same complex number I input into
my matrix element?