mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add manual doc on STL-compatible iterators
This commit is contained in:
4
doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp
Normal file
4
doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
VectorXi v = VectorXi::Random(4);
|
||||
cout << "Here is the vector v:\n";
|
||||
for(auto x : v) cout << x << " ";
|
||||
cout << "\n";
|
||||
5
doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp
Normal file
5
doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
Matrix2i A = Matrix2i::Random();
|
||||
cout << "Here are the coeffs of the 2x2 matrix A:\n";
|
||||
for(auto x : A.reshaped())
|
||||
cout << x << " ";
|
||||
cout << "\n";
|
||||
4
doc/snippets/Tutorial_std_sort.cpp
Normal file
4
doc/snippets/Tutorial_std_sort.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
Array4i v = Array4i::Random().abs();
|
||||
cout << "Here is the initial vector v:\n" << v.transpose() << "\n";
|
||||
std::sort(v.begin(), v.end());
|
||||
cout << "Here is the sorted vector v:\n" << v.transpose() << "\n";
|
||||
5
doc/snippets/Tutorial_std_sort_rows.cpp
Normal file
5
doc/snippets/Tutorial_std_sort_rows.cpp
Normal file
@@ -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";
|
||||
Reference in New Issue
Block a user