aboutsummaryrefslogtreecommitdiff
path: root/doc/examples/Tutorial_BlockOperations_vector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/Tutorial_BlockOperations_vector.cpp')
-rw-r--r--doc/examples/Tutorial_BlockOperations_vector.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/examples/Tutorial_BlockOperations_vector.cpp b/doc/examples/Tutorial_BlockOperations_vector.cpp
new file mode 100644
index 000000000..4a0b02342
--- /dev/null
+++ b/doc/examples/Tutorial_BlockOperations_vector.cpp
@@ -0,0 +1,14 @@
+#include <Eigen/Dense>
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ Eigen::ArrayXf v(6);
+ v << 1, 2, 3, 4, 5, 6;
+ cout << "v.head(3) =" << endl << v.head(3) << endl << endl;
+ cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl;
+ v.segment(1,4) *= 2;
+ cout << "after 'v.segment(1,4) *= 2', v =" << endl << v << endl;
+}