Matrix 如何获得特征::矩阵xD列的平均值?

Matrix 如何获得特征::矩阵xD列的平均值?,matrix,eigen,eigen3,Matrix,Eigen,Eigen3,我知道函数和存在于本征函数中 我在上的堆栈溢出中看到了这个示例。然而,这对我不起作用 有人能为我澄清一下如何得到某一行或某一列的平均值吗 e、 g.第三排 e、 g.第二栏 非常感谢!祝你有美好的一天 与colwise/rowwise相同,但在单个列/行上: MatrixXd mat(...); // Fill the matrix double meanCol3 = mat.col(3).mean(); double meanRow2 = mat.row(2).mean(); 与colwis

我知道函数和存在于本征函数中

我在上的堆栈溢出中看到了这个示例。然而,这对我不起作用

有人能为我澄清一下如何得到某一行或某一列的平均值吗

e、 g.第三排

e、 g.第二栏


非常感谢!祝你有美好的一天

与colwise/rowwise相同,但在单个列/行上:

MatrixXd mat(...);
// Fill the matrix
double meanCol3 = mat.col(3).mean();
double meanRow2 = mat.row(2).mean();

与colwise/rowwise相同,但在单个列/行上:

MatrixXd mat(...);
// Fill the matrix
double meanCol3 = mat.col(3).mean();
double meanRow2 = mat.row(2).mean();