Add manual doc on STL-compatible iterators

This commit is contained in:
Gael Guennebaud
2018-11-12 22:06:33 +01:00
parent 0105146915
commit c81bdbdadc
6 changed files with 46 additions and 51 deletions

View 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";

View 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";

View 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";

View 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";