1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <Eigen/Dense>
#include <iostream>
#include <cmath>
using namespace Eigen;
int main()
{
MatrixXf m1(10,1);
m1 << 50,51,52,54,53,60,59,65,67,70;
MatrixXf m3(3,10);
MatrixXf m2(10,3);
m3<< 1,1,1,1,1,1,1,1,1,1, //Xf[,5:6]
54,61,52,70,63,0,0,0,0,0,
0,0,0,0,0,79,68,65,79,76;
m2 << m3.transpose();
MatrixXf I(10,10);
I.setIdentity(10,10);
float SSE =(m1.transpose()*(I-m2*(m2.transpose()*m2).inverse()*m2.transpose())*m1).determinant();
std::cout << "SSE=" << std::endl;
std::cout << SSE << std::endl << std::endl;
system("pause");
}
|