SVD.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::Core
17 * @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu )
18 * @date 2015
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include <math.h>
26 
27 #include <Eigen/Eigen>
28 
29 namespace armarx::math
30 {
31  class SVD
32  {
33  private:
34  Eigen::JacobiSVD<Eigen::MatrixXf> svd;
35 
36  public:
37  Eigen::MatrixXf matrixU;
38  Eigen::MatrixXf matrixV;
39  Eigen::VectorXf singularValues;
40 
41  SVD(Eigen::MatrixXf matrix) : svd(matrix, Eigen::ComputeThinU | Eigen::ComputeThinV)
42  {
43  matrixU = svd.matrixU();
44  matrixV = svd.matrixV();
45  singularValues = svd.singularValues();
46  }
47 
48  Eigen::Vector3f
50  {
51  return matrixU.block<3, 1>(0, nr);
52  }
53 
54  float
56  {
57  return singularValues(nr);
58  }
59  };
60 } // namespace armarx::math
Eigen
Definition: Elements.h:32
armarx::math::SVD::getLeftSingularVector3D
Eigen::Vector3f getLeftSingularVector3D(int nr)
Definition: SVD.h:49
armarx::math::SVD
Definition: SVD.h:31
armarx::math::SVD::matrixU
Eigen::MatrixXf matrixU
Definition: SVD.h:37
armarx::math::SVD::singularValues
Eigen::VectorXf singularValues
Definition: SVD.h:39
armarx::math::SVD::matrixV
Eigen::MatrixXf matrixV
Definition: SVD.h:38
armarx::math
Definition: LinearizeAngularTrajectory.cpp:28
armarx::math::SVD::getLeftSingularValue
float getLeftSingularValue(int nr)
Definition: SVD.h:55
armarx::math::SVD::SVD
SVD(Eigen::MatrixXf matrix)
Definition: SVD.h:41