00001 MatrixXd X = MatrixXd::Random(4,4); 00002 MatrixXd A = X * X.transpose(); 00003 cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; 00004 00005 SelfAdjointEigenSolver<MatrixXd> es(A); 00006 MatrixXd sqrtA = es.operatorSqrt(); 00007 cout << "The square root of A is: " << endl << sqrtA << endl; 00008 cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl;