Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
matrix.hpp
Go to the documentation of this file.
1 #ifndef TAPKEE_MATRIX_H_
2 #define TAPKEE_MATRIX_H_
3 
4 namespace tapkee
5 {
6 namespace tapkee_internal
7 {
8 
9 void centerMatrix(DenseMatrix& matrix)
10 {
11  DenseVector col_means = matrix.colwise().mean().transpose();
12  DenseMatrix::Scalar grand_mean = matrix.mean();
13  matrix.array() += grand_mean;
14  matrix.rowwise() -= col_means.transpose();
15  matrix.colwise() -= col_means;
16 }
17 
18 } // End of tapkee_internal
19 } // End of tapkee
20 #endif