Various documentation updates:

- update the tutorial
- update doc of deprecated cwise function
- update cwise doc snippets
This commit is contained in:
Gael Guennebaud
2010-01-06 17:18:38 +01:00
parent c11300dbd5
commit 7d3fe69eff
43 changed files with 320 additions and 472 deletions

View File

@@ -1,2 +1,2 @@
Vector3d v(1,-2,-3);
cout << v.cwise().abs() << endl;
Array3d v(1,-2,-3);
cout << v.abs() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,-2,-3);
cout << v.cwise().abs2() << endl;
Array3d v(1,-2,-3);
cout << v.abs2() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(M_PI, M_PI/2, M_PI/3);
cout << v.cwise().cos() << endl;
Array3d v(M_PI, M_PI/2, M_PI/3);
cout << v.cos() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4);
cout << v.cwise().cube() << endl;
Array3d v(2,3,4);
cout << v.cube() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()==w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v==w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3);
cout << v.cwise().exp() << endl;
Array3d v(1,2,3);
cout << v.exp() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()>w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v>w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()>=w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v>=w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4);
cout << v.cwise().inverse() << endl;
Array3d v(2,3,4);
cout << v.inverse() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()<w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v<w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()<=w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v<=w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3);
cout << v.cwise().log() << endl;
Array3d v(1,2,3);
cout << v.log() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise().max(w) << endl;
Array3d v(2,3,4), w(4,2,3);
cout << v.max(w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise().min(w) << endl;
Array3d v(2,3,4), w(4,2,3);
cout << v.min(w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3);
cout << v.cwise()-5 << endl;
Array3d v(1,2,3);
cout << v-5 << endl;

View File

@@ -1,3 +1,3 @@
Vector3d v(1,2,3);
v.cwise() -= 5;
Array3d v(1,2,3);
v -= 5;
cout << v << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3), w(3,2,1);
cout << (v.cwise()!=w) << endl;
Array3d v(1,2,3), w(3,2,1);
cout << (v!=w) << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,3);
cout << v.cwise()+5 << endl;
Array3d v(1,2,3);
cout << v+5 << endl;

View File

@@ -1,3 +1,3 @@
Vector3d v(1,2,3);
v.cwise() += 5;
Array3d v(1,2,3);
v += 5;
cout << v << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(8,27,64);
cout << v.cwise().pow(0.333333) << endl;
Array3d v(8,27,64);
cout << v.pow(0.333333) << endl;

View File

@@ -1,4 +1,4 @@
Matrix3i a = Matrix3i::Random(), b = Matrix3i::Random();
Matrix3i c = a.cwise() * b;
Array33i a = Array33i::Random(), b = Array33i::Random();
Array33i c = a * b;
cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise()/w << endl;
Array3d v(2,3,4), w(4,2,3);
cout << v/w << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(M_PI, M_PI/2, M_PI/3);
cout << v.cwise().sin() << endl;
Array3d v(M_PI, M_PI/2, M_PI/3);
cout << v.sin() << endl;

View File

@@ -1,4 +1,3 @@
Vector3d v(3,2,4);
Vector3d w(5,4,2);
v.cwise() /= w;
Array3d v(3,2,4), w(5,4,2);
v /= w;
cout << v << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(1,2,4);
cout << v.cwise().sqrt() << endl;
Array3d v(1,2,4);
cout << v.sqrt() << endl;

View File

@@ -1,2 +1,2 @@
Vector3d v(2,3,4);
cout << v.cwise().square() << endl;
Array3d v(2,3,4);
cout << v.square() << endl;

View File

@@ -1,4 +1,3 @@
Vector3d v(1,2,3);
Vector3d w(2,3,0);
v.cwise() *= w;
Array3d v(1,2,3), w(2,3,0);
v *= w;
cout << v << endl;

View File

@@ -1,7 +1,7 @@
Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwise().abs();
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.cwise()<p0).all() && (boxMax.cwise()>p0).all()) << endl;
<< ((boxMin.array()<p0.array()).all() && (boxMax.array()>p0.array()).all()) << endl;
cout << "Is (" << p1.transpose() << ") inside the box: "
<< ((boxMin.cwise()<p1).all() && (boxMax.cwise()>p1).all()) << endl;
<< ((boxMin.array()<p1.array()).all() && (boxMax.array()>p1.array()).all()) << endl;

View File

@@ -1,4 +1,4 @@
Vector3d v(1,2,3);
v.cwise() += 3;
v.cwise() -= 2;
v.array() += 3;
v.array() -= 2;
cout << v << endl;

View File

@@ -0,0 +1,4 @@
Vector3d v(-1,2,-3);
cout << "the absolute values:" << endl << v.array().abs() << endl;
cout << "the absolute values plus one:" << endl << v.array().abs()+1 << endl;
cout << "sum of the squares: " << v.array().square().sum() << endl;

View File

@@ -2,4 +2,4 @@ Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl;
cout << "Here is the maximum absolute value of each column:"
<< endl << m.cwise().abs().colwise().maxCoeff() << endl;
<< endl << m.cwiseAbs().colwise().maxCoeff() << endl;

View File

@@ -1,4 +0,0 @@
Vector3d v(-1,2,-3);
cout << "the absolute values:" << endl << v.cwise().abs() << endl;
cout << "the absolute values plus one:" << endl << v.cwise().abs().cwise()+1 << endl;
cout << "sum of the squares: " << v.cwise().square().sum() << endl;

View File

@@ -1,5 +0,0 @@
Matrix2d m; m << 1,2,3,4;
cout << (m*m).lazy().row(0) << endl;
// this computes only one row of the product. By contrast,
// if we did "(m*m).row(0);" then m*m would first be evaluated into
// a temporary, because the Product expression has the EvalBeforeNestingBit.

View File

@@ -0,0 +1,3 @@
Matrix2d a, b, c; a << 1,2,3,4; b << 5,6,7,8;
c.noalias() = a * b; // this computes the product directly to c
cout << c << endl;

View File

@@ -2,4 +2,4 @@ Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;
cout << "Here is the maximum absolute value of each row:"
<< endl << m.cwise().abs().rowwise().maxCoeff() << endl;
<< endl << m.cwiseAbs().rowwise().maxCoeff() << endl;

View File

@@ -1,6 +1,6 @@
MatrixXi m(3, 3);
m << 1, 2, 3,
4, 5, 6,
m << 1, 2, 3,
4, 5, 6,
7, 8, 9;
m = (m.cwise() >= 5).select(-m, m);
m = (m.array() >= 5).select(-m, m);
cout << m << endl;

View File

@@ -1,3 +1,3 @@
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl << (m.cwise() >= 0.5).rowwise().count() << endl;
cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl << (m.array() >= 0.5).rowwise().count() << endl;