0

I have a matrix X;

   Eigen::MatrixXcf X = Shapes.block(0,0,Shapes.rows(),data.cols()) * std::complex<float>(0,1) +
        Shapes.block(0,data.cols(),Shapes.rows(),data.cols())*std::complex<float>(1,0);

I have verified that numbers are correct in matlab to what i expects. Then i do following in Eigen.

Eigen::MatrixXcf A =  X.transpose() * X;

And verifieing the numbers in matlab now, A is not the same as if i used X'X in matlab. Am i missing something?

Example:

(21.5056,-85.0501) (19.9044,-84.2936) (18.0362,-59.8332) (41.4988,-81.8243) (36.6729,-83.0033) (38.0295,-56.6073) (64.0719,-74.0823) (58.601,-73.3259) (70.2767,-47.5751) (88.5798,-58.5984) (82.4639,-58.4872) (93.4947,-37.2525) (105.993,-43.7597) (104.392,-44.2936) (112.198,-26.2848)

> (21.5056,-85.0501) (41.4988,-81.8243) (64.0719,-74.0823) 
> (88.5798,-58.5984) (105 .993,-43.7597) (19.9044,-84.2936)
> (36.6729,-83.0033)  (58.601,-73.3259) (82.4639,-58.4872) 
> (104.392,-44.2936) (18.0362,-59.8332) (38.0295,-56.6073)
> (70.2767,-47.5751) (93.4947,-37.2525) (112 .198,-26.2848)



 (-16735,-9172.05)   (-15034.5,-13329) (-11516.3,-18504.6) (-6910.19,-23175.2)
(-2647.21,-26824.3)
  (-15034.5,-13329) (-12275.9,-17184.7) (-7360.56,-21657.5) (-1502.46,-25378.6)
 (3748.75,-28128.9)
(-11516.3,-18504.6) (-7360.56,-21657.5)   (-650.169,-24774)  (6676.41,-26856.9)
 (13053.4,-28091.3)
(-6910.19,-23175.2) (-1502.46,-25378.6)  (6676.41,-26856.9)  (15145.7,-26993.3)
 (22353.3,-26482.6)
(-2647.21,-26824.3)  (3748.75,-28128.9)  (13053.4,-28091.3)  (22353.3,-26482.6)
   (30153,-24422.5)




Eigen::MatrixXcf B = X.topLeftCorner<3,5>();
Eigen::MatrixXcf C = X.topLeftCorner<3,5>();
B.transposeInPlace();

std::cout << B << std::endl<<std::endl;
std::cout << C << std::endl<<std::endl;
std::cout << B*C << std::endl;
4

1 に答える 1

2

Yes, X' is the adjoint of X, that is the conjugate transpose, and not simply the transpose. In Eigen do:

A = X.adjoint() * X;

or equivalently:

A = X.transpose().conjugate() * X;
于 2013-01-28T22:32:52.903 に答える