参考知识点:
1、这个说的非常详细:协方差矩阵计算方法
( 推荐手动求解他的例子)
代码:
#include <iostream>
#include<vector>
#include<fstream>
using namespace std;
int main()
{
int m, n;
cout << "请输入矩阵的行、列数:" << endl;
cin >> m >> n;
vector<vector<double>> matrix(m, vector<double>(n));
vector<vector<double>> matrixT(n, vector<double>(m));
cout << "输入矩阵中:" << endl;
ifstream fin("inputData.txt"