summaryrefslogtreecommitdiffhomepage
path: root/eigen/doc/examples/Tutorial_BlockOperations_vector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/doc/examples/Tutorial_BlockOperations_vector.cpp')
-rw-r--r--eigen/doc/examples/Tutorial_BlockOperations_vector.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/eigen/doc/examples/Tutorial_BlockOperations_vector.cpp b/eigen/doc/examples/Tutorial_BlockOperations_vector.cpp
new file mode 100644
index 0000000..4a0b023
--- /dev/null
+++ b/eigen/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;
+}