xref: /aosp_15_r20/external/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li MatrixXi m(2,2);
2*bf2c3715SXin Li m << 1, 0,
3*bf2c3715SXin Li      1, 1;
4*bf2c3715SXin Li cout << "Comparing m with identity matrix:" << endl;
5*bf2c3715SXin Li cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl;
6*bf2c3715SXin Li Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count();
7*bf2c3715SXin Li cout << "Number of coefficients that are equal: " << count << endl;
8