aboutsummaryrefslogtreecommitdiff
path: root/unsupported/doc/examples/MatrixExponential.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unsupported/doc/examples/MatrixExponential.cpp')
-rw-r--r--unsupported/doc/examples/MatrixExponential.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/unsupported/doc/examples/MatrixExponential.cpp b/unsupported/doc/examples/MatrixExponential.cpp
new file mode 100644
index 000000000..ebd3b9675
--- /dev/null
+++ b/unsupported/doc/examples/MatrixExponential.cpp
@@ -0,0 +1,16 @@
+#include <unsupported/Eigen/MatrixFunctions>
+#include <iostream>
+
+using namespace Eigen;
+
+int main()
+{
+ const double pi = std::acos(-1.0);
+
+ MatrixXd A(3,3);
+ A << 0, -pi/4, 0,
+ pi/4, 0, 0,
+ 0, 0, 0;
+ std::cout << "The matrix A is:\n" << A << "\n\n";
+ std::cout << "The matrix exponential of A is:\n" << A.exp() << "\n\n";
+}