2018-10-06 05:11:21 +08:00
|
|
|
Matrix3i m = Matrix3i::Random();
|
|
|
|
|
cout << "Here is the initial matrix m:" << endl << m << endl;
|
|
|
|
|
int i = -1;
|
2023-12-06 05:22:55 +08:00
|
|
|
for (auto c : m.colwise()) {
|
2018-10-06 05:11:21 +08:00
|
|
|
c *= i;
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
cout << "Here is the matrix m after the for-range-loop:" << endl << m << endl;
|
|
|
|
|
auto cols = m.colwise();
|
2023-12-06 05:22:55 +08:00
|
|
|
auto it = std::find_if(cols.cbegin(), cols.cend(), [](Matrix3i::ConstColXpr x) { return x.squaredNorm() == 0; });
|
|
|
|
|
cout << "The first empty column is: " << distance(cols.cbegin(), it) << endl;
|