1MatrixXd 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;
9