Rev | Line | |
---|
[136] | 1 | #include <Eigen/Dense>
|
---|
| 2 | #include <iostream>
|
---|
| 3 |
|
---|
| 4 | using namespace Eigen;
|
---|
| 5 | using namespace std;
|
---|
| 6 |
|
---|
| 7 | int main(int, char**)
|
---|
| 8 | {
|
---|
| 9 | cout.precision(3);
|
---|
| 10 | MatrixXi m(2,2);
|
---|
| 11 | m << 1, 0,
|
---|
| 12 | 1, 1;
|
---|
| 13 | cout << "Comparing m with identity matrix:" << endl;
|
---|
| 14 | cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl;
|
---|
| 15 | int count = m.cwiseEqual(MatrixXi::Identity(2,2)).count();
|
---|
| 16 | cout << "Number of coefficients that are equal: " << count << endl;
|
---|
| 17 |
|
---|
| 18 | return 0;
|
---|
| 19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.