diff options
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/QuickStart_example.cpp | 10 | ||||
-rw-r--r-- | doc/examples/QuickStart_example2_dynamic.cpp | 15 | ||||
-rw-r--r-- | doc/examples/QuickStart_example2_fixed.cpp | 15 |
3 files changed, 36 insertions, 4 deletions
diff --git a/doc/examples/QuickStart_example.cpp b/doc/examples/QuickStart_example.cpp index 5337f0f4f..3fbd6fab2 100644 --- a/doc/examples/QuickStart_example.cpp +++ b/doc/examples/QuickStart_example.cpp @@ -2,12 +2,14 @@ #include <Eigen/Dense> using Eigen::MatrixXd; +using Eigen::VectorXd; int main(int, char *[]) { - MatrixXd m(2,3); - m(0,0) = -3; - m(1,0) = 1.5; - m.rightCols(2) = MatrixXd::Identity(2,2); + MatrixXd m(2,2); + m(0,0) = 3; + m(1,0) = 2.5; + m(0,1) = -1; + m(1,1) = m(1,0) + m(0,1); std::cout << 2*m << std::endl; } diff --git a/doc/examples/QuickStart_example2_dynamic.cpp b/doc/examples/QuickStart_example2_dynamic.cpp new file mode 100644 index 000000000..c304c934a --- /dev/null +++ b/doc/examples/QuickStart_example2_dynamic.cpp @@ -0,0 +1,15 @@ +#include <iostream> +#include <Eigen/Dense> + +using Eigen::MatrixXd; +using Eigen::VectorXd; + +int main(int, char *[]) +{ + MatrixXd m(3,3); + for (int rowIndex = 0; rowIndex < 3; ++rowIndex) + for (int columnIndex = 0; columnIndex < 3; ++columnIndex) + m(rowIndex, columnIndex) = rowIndex + 0.01 * columnIndex; + VectorXd v = VectorXd::Ones(3); + std::cout << m * v << std::endl; +} diff --git a/doc/examples/QuickStart_example2_fixed.cpp b/doc/examples/QuickStart_example2_fixed.cpp new file mode 100644 index 000000000..6d7d63d15 --- /dev/null +++ b/doc/examples/QuickStart_example2_fixed.cpp @@ -0,0 +1,15 @@ +#include <iostream> +#include <Eigen/Dense> + +using Eigen::Matrix3d; +using Eigen::Vector3d; + +int main(int, char *[]) +{ + Matrix3d m; + for (int rowIndex = 0; rowIndex < 3; ++rowIndex) + for (int columnIndex = 0; columnIndex < 3; ++columnIndex) + m(rowIndex, columnIndex) = rowIndex + 0.01 * columnIndex; + Vector3d v = Vector3d::Ones(); + std::cout << m * v << std::endl; +} |