Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
matrix.hpp
Go to the documentation of this file.
1 /* This software is distributed under BSD 3-clause license (see LICENSE file).
2  *
3  * Copyright (c) 2012-2013 Sergey Lisitsyn
4  */
5 
6 #ifndef TAPKEE_MATRIX_H_
7 #define TAPKEE_MATRIX_H_
8 
9 namespace tapkee
10 {
11 namespace tapkee_internal
12 {
13 
15 {
16  DenseVector col_means = matrix.colwise().mean().transpose();
17  DenseMatrix::Scalar grand_mean = matrix.mean();
18  matrix.array() += grand_mean;
19  matrix.rowwise() -= col_means.transpose();
20  matrix.colwise() -= col_means;
21 }
22 
23 } // End of tapkee_internal
24 } // End of tapkee
25 #endif
void centerMatrix(DenseMatrix &matrix)
Definition: matrix.hpp:14
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, Eigen::Dynamic > DenseMatrix
dense matrix type (non-overridable)
Definition: types.hpp:23
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, 1 > DenseVector
dense vector type (non-overridable)
Definition: types.hpp:21