blob: eeacca74becdf24c41b5916005e63e88a4e55fe6 [file] [log] [blame]
Brian Silverman72890c22015-09-19 14:37:37 -04001MatrixXd X = MatrixXd::Random(4,4);
2MatrixXd A = X * X.transpose();
3cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
4
5SelfAdjointEigenSolver<MatrixXd> es(A);
6MatrixXd sqrtA = es.operatorSqrt();
7cout << "The square root of A is: " << endl << sqrtA << endl;
8cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl;