mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
more documentation, 12 more code snippets
This commit is contained in:
5
doc/snippets/MatrixBase_map.cpp
Normal file
5
doc/snippets/MatrixBase_map.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int data[4] = {1,3,0,2};
|
||||
cout << Matrix2i::map(data) << endl;
|
||||
Matrix2i::map(data) *= 2;
|
||||
cout << "The data is now:" << endl;
|
||||
for(int i = 0; i < 4; i++) cout << data[i] << endl;
|
||||
5
doc/snippets/MatrixBase_map_int.cpp
Normal file
5
doc/snippets/MatrixBase_map_int.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int data[4] = {1,3,0,2};
|
||||
cout << VectorXi::map(data, 4) << endl;
|
||||
VectorXi::map(data, 4) *= 2;
|
||||
cout << "The data is now:" << endl;
|
||||
for(int i = 0; i < 4; i++) cout << data[i] << endl;
|
||||
5
doc/snippets/MatrixBase_map_int_int.cpp
Normal file
5
doc/snippets/MatrixBase_map_int_int.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int data[4] = {1,3,0,2};
|
||||
cout << MatrixXi::map(data, 2, 2) << endl;
|
||||
MatrixXi::map(data, 2, 2) *= 2;
|
||||
cout << "The data is now:" << endl;
|
||||
for(int i = 0; i < 4; i++) cout << data[i] << endl;
|
||||
2
doc/snippets/MatrixBase_ones.cpp
Normal file
2
doc/snippets/MatrixBase_ones.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
cout << Matrix2d::ones() << endl;
|
||||
cout << 6 * RowVector4i::ones() << endl;
|
||||
2
doc/snippets/MatrixBase_ones_int.cpp
Normal file
2
doc/snippets/MatrixBase_ones_int.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
cout << 6 * RowVectorXi::ones(4) << endl;
|
||||
cout << VectorXf::ones(2) << endl;
|
||||
1
doc/snippets/MatrixBase_ones_int_int.cpp
Normal file
1
doc/snippets/MatrixBase_ones_int_int.cpp
Normal file
@@ -0,0 +1 @@
|
||||
cout << MatrixXi::ones(2,3) << endl;
|
||||
1
doc/snippets/MatrixBase_random.cpp
Normal file
1
doc/snippets/MatrixBase_random.cpp
Normal file
@@ -0,0 +1 @@
|
||||
cout << 100 * Matrix2i::random() << endl;
|
||||
1
doc/snippets/MatrixBase_random_int.cpp
Normal file
1
doc/snippets/MatrixBase_random_int.cpp
Normal file
@@ -0,0 +1 @@
|
||||
cout << VectorXi::random(2) << endl;
|
||||
1
doc/snippets/MatrixBase_random_int_int.cpp
Normal file
1
doc/snippets/MatrixBase_random_int_int.cpp
Normal file
@@ -0,0 +1 @@
|
||||
cout << MatrixXi::random(2,3) << endl;
|
||||
@@ -1,4 +1,4 @@
|
||||
Matrix2f m = Matrix2f::random();
|
||||
Matrix2i m = Matrix2i::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
|
||||
|
||||
2
doc/snippets/MatrixBase_zero.cpp
Normal file
2
doc/snippets/MatrixBase_zero.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
cout << Matrix2d::zero() << endl;
|
||||
cout << RowVector4i::zero() << endl;
|
||||
2
doc/snippets/MatrixBase_zero_int.cpp
Normal file
2
doc/snippets/MatrixBase_zero_int.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
cout << RowVectorXi::zero(4) << endl;
|
||||
cout << VectorXf::zero(2) << endl;
|
||||
1
doc/snippets/MatrixBase_zero_int_int.cpp
Normal file
1
doc/snippets/MatrixBase_zero_int_int.cpp
Normal file
@@ -0,0 +1 @@
|
||||
cout << MatrixXi::zero(2,3) << endl;
|
||||
Reference in New Issue
Block a user