aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
diff options
context:
space:
mode:
authorGravatar David Tellenbach <david.tellenbach@tellnotes.org>2019-01-21 16:25:57 +0100
committerGravatar David Tellenbach <david.tellenbach@tellnotes.org>2019-01-21 16:25:57 +0100
commitdb152b9ee6effd3799f70a621f495c427cb3c33f (patch)
tree25a9c96f0cdfbed28072ea7e2f8602412ce6de7f /doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
parent543529da6a1eabf415f4f8b56495fad76b57ba22 (diff)
PR 572: Add initializer list constructors to Matrix and Array (include unit tests and doc)
- {1,2,3,4,5,...} for fixed-size vectors only - {{1,2,3},{4,5,6}} for the general cases - {{1,2,3,4,5,....}} is allowed for both row and column-vector
Diffstat (limited to 'doc/snippets/Tutorial_std_sort_rows_cxx11.cpp')
-rw-r--r--doc/snippets/Tutorial_std_sort_rows_cxx11.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp b/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
new file mode 100644
index 000000000..fdd850d13
--- /dev/null
+++ b/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp
@@ -0,0 +1,5 @@
+ArrayXXi A = ArrayXXi::Random(4,4).abs();
+cout << "Here is the initial matrix A:\n" << A << "\n";
+for(auto row : A.rowwise())
+ std::sort(row.begin(), row.end());
+cout << "Here is the sorted matrix A:\n" << A << "\n"; \ No newline at end of file