aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-12 23:17:31 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-12 23:17:31 +0000
commit8bca23bbec33a5ef755da641116418f4dc90e0da (patch)
treec7dbb07a3e719c2956fce6bc13b70e62c1ded008 /doc/snippets
parent1a6597b8e44e2f828e6da017d1aef1e1be3d5f81 (diff)
Mention comma initializer can be used to concatenate vectors
(inspired by a question on IRC)
Diffstat (limited to 'doc/snippets')
-rw-r--r--doc/snippets/Tutorial_AdvancedInitialization_Join.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp b/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp
new file mode 100644
index 000000000..84e8715cb
--- /dev/null
+++ b/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp
@@ -0,0 +1,11 @@
+RowVectorXd vec1(3);
+vec1 << 1, 2, 3;
+std::cout << "vec1 = " << vec1 << std::endl;
+
+RowVectorXd vec2(4);
+vec2 << 1, 4, 9, 16;;
+std::cout << "vec2 = " << vec2 << std::endl;
+
+RowVectorXd joined(7);
+joined << vec1, vec2;
+std::cout << "joined = " << joined << std::endl;