mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
matrix storage order can now also be row-dominant (choosable for each matrix separately)
map() moves from MatrixBase to Matrix much more documentation/examples/snippets
This commit is contained in:
3
doc/snippets/MatrixBase_adjoint.cpp
Normal file
3
doc/snippets/MatrixBase_adjoint.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Matrix2cf m = Matrix2cf::random();
|
||||
cout << "Here is the 2x2 complex matrix m:" << endl << m << endl;
|
||||
cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl;
|
||||
@@ -1,3 +1,5 @@
|
||||
Matrix4d m = Matrix4d::diagonal(Vector4d(1,2,3,4));
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is m.block<2, 2>(2, 2):" << endl << m.block<2, 2>(2, 2) << endl;
|
||||
m.block<2, 2>(2, 0) = m.block<2, 2>(2, 2);
|
||||
cout << m << endl;
|
||||
cout << "Now the matrix m is:" << endl << m << endl;
|
||||
|
||||
4
doc/snippets/MatrixBase_diagonal.cpp
Normal file
4
doc/snippets/MatrixBase_diagonal.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
Matrix3i m = Matrix3i::random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here are the coefficients on the main diagonal of m:" << endl
|
||||
<< m.diagonal() << endl;
|
||||
@@ -1,3 +1,5 @@
|
||||
Matrix3d m = Matrix3d::diagonal(Vector3d(1,2,3));
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is m.dynBlock(1, 1, 2, 1):" << endl << m.dynBlock(1, 1, 2, 1) << endl;
|
||||
m.dynBlock(1, 0, 2, 1) = m.dynBlock(1, 1, 2, 1);
|
||||
cout << m << endl;
|
||||
cout << "Now the matrix m is:" << endl << m << endl;
|
||||
|
||||
12
doc/snippets/MatrixBase_eval.cpp
Normal file
12
doc/snippets/MatrixBase_eval.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
Matrix2f M = Matrix2f::random();
|
||||
Matrix2f m;
|
||||
m = M;
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Now we want to replace m by its own transpose." << endl;
|
||||
cout << "If we do m = m.transpose(), then m becomes:" << endl;
|
||||
m = m.transpose();
|
||||
cout << m << endl << "which is wrong!" << endl;
|
||||
cout << "Now let us instead do m = m.transpose().eval(). Then m becomes" << endl;
|
||||
m = M;
|
||||
m = m.transpose().eval();
|
||||
cout << m << endl << "which is right." << endl;
|
||||
3
doc/snippets/MatrixBase_minor.cpp
Normal file
3
doc/snippets/MatrixBase_minor.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Matrix3i m = Matrix3i::random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is m.minor(1,1):" << endl << m.minor(1,1) << endl;
|
||||
8
doc/snippets/MatrixBase_transpose.cpp
Normal file
8
doc/snippets/MatrixBase_transpose.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
Matrix2f m = Matrix2f::random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is the transpose of m:" << endl << m.transpose() << endl;
|
||||
cout << "Here is the coefficient (1,0) in the transpose of m:" << endl
|
||||
<< m.transpose()(1,0) << endl;
|
||||
cout << "Let us overwrite this coefficient with the value 0." << endl;
|
||||
m.transpose()(1,0) = 0;
|
||||
cout << "Now the matrix m is:" << endl << m << endl;
|
||||
Reference in New Issue
Block a user