https://blog.csdn.net/unlimitedai/article/details/86257890
第五题答案:
#include <iostream>
#include <cmath>
using namespace std;
#include <Eigen/Core>
#include <Eigen/Geometry>
int main(int argc, char **argv) {
Eigen::Matrix<float, 10, 10> Matrix_10;
Matrix_10 = Eigen::Matrix<float, 10, 10>::Random(); //对Matrix_10矩阵进行随机初始化
cout << "one:\n" << Matrix_10 << endl;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i == j) {
Matrix_10(i, j) = 1;
} else {
Matrix_10(i, j) = 0;
}
}
}
cout << "answer =\n" << Matrix_10 << endl;
return 0;
}
第七题答案:
#include <iostr