aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/doc
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-01-11 18:05:30 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-01-11 18:05:30 +0000
commit65cd1c7639e6dab0416ecc440b01e7257554dfc0 (patch)
tree11e189a6ac1b738b8245798e3e5c9e88608b0fc0 /unsupported/doc
parenta05d42616b6ae486e1329644355d2cd8a65739ad (diff)
Add support for matrix sine, cosine, sinh and cosh.
Diffstat (limited to 'unsupported/doc')
-rw-r--r--unsupported/doc/examples/MatrixSine.cpp21
-rw-r--r--unsupported/doc/examples/MatrixSinh.cpp21
2 files changed, 42 insertions, 0 deletions
diff --git a/unsupported/doc/examples/MatrixSine.cpp b/unsupported/doc/examples/MatrixSine.cpp
new file mode 100644
index 000000000..f8780ac92
--- /dev/null
+++ b/unsupported/doc/examples/MatrixSine.cpp
@@ -0,0 +1,21 @@
+#include <unsupported/Eigen/MatrixFunctions>
+
+using namespace Eigen;
+
+int main()
+{
+ MatrixXd A = MatrixXd::Random(3,3);
+ std::cout << "A = \n" << A << "\n\n";
+
+ MatrixXd sinA;
+ ei_matrix_sin(A, &sinA);
+ std::cout << "sin(A) = \n" << sinA << "\n\n";
+
+ MatrixXd cosA;
+ ei_matrix_cos(A, &cosA);
+ std::cout << "cos(A) = \n" << cosA << "\n\n";
+
+ // The matrix functions satisfy sin^2(A) + cos^2(A) = I,
+ // like the scalar functions.
+ std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n";
+}
diff --git a/unsupported/doc/examples/MatrixSinh.cpp b/unsupported/doc/examples/MatrixSinh.cpp
new file mode 100644
index 000000000..488d95652
--- /dev/null
+++ b/unsupported/doc/examples/MatrixSinh.cpp
@@ -0,0 +1,21 @@
+#include <unsupported/Eigen/MatrixFunctions>
+
+using namespace Eigen;
+
+int main()
+{
+ MatrixXf A = MatrixXf::Random(3,3);
+ std::cout << "A = \n" << A << "\n\n";
+
+ MatrixXf sinhA;
+ ei_matrix_sinh(A, &sinhA);
+ std::cout << "sinh(A) = \n" << sinhA << "\n\n";
+
+ MatrixXf coshA;
+ ei_matrix_cosh(A, &coshA);
+ std::cout << "cosh(A) = \n" << coshA << "\n\n";
+
+ // The matrix functions satisfy cosh^2(A) - sinh^2(A) = I,
+ // like the scalar functions.
+ std::cout << "cosh^2(A) - sinh^2(A) = \n" << coshA*coshA - sinhA*sinhA << "\n\n";
+}