wbc
SVD.hpp
Go to the documentation of this file.
1// Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
2
3// Version: 1.0
4// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
5// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
6// URL: http://www.orocos.org/kdl
7
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Lesser General Public
10// License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Lesser General Public License for more details.
17
18// You should have received a copy of the GNU Lesser General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
22
23//Based on the svd of the KDL-0.2 library by Erwin Aertbelien
24
25#ifndef SVD_DECOMPOSITION_HPP
26#define SVD_DECOMPOSITION_HPP
27
28#include <base/Eigen.hpp>
29
30namespace wbc{
31
32inline double PYTHAG(double a,double b) {
33 double at,bt,ct;
34 at = fabs(a);
35 bt = fabs(b);
36 if (at > bt ) {
37 ct=bt/at;
38 return at*sqrt(1.0+ct*ct);
39 } else {
40 if (bt==0)
41 return 0.0;
42 else {
43 ct=at/bt;
44 return bt*sqrt(1.0+ct*ct);
45 }
46 }
47}
48
49inline double SIGN(double a,double b) {
50 return ((b) >= 0.0 ? fabs(a) : -fabs(a));
51}
52
53int svd_eigen_decomposition(const base::MatrixXd& A,
54 base::MatrixXd& U,
55 base::VectorXd& S,
56 base::MatrixXd& V,
57 base::VectorXd& tmp,
58 int maxiter=150,
59 double epsilon=1e-300);
60
61}
62
63#endif // SVD_DECOMPOSITION_HPP
Definition ContactsAccelerationConstraint.cpp:3
double PYTHAG(double a, double b)
Definition SVD.hpp:32
double SIGN(double a, double b)
Definition SVD.hpp:49
int svd_eigen_decomposition(const base::MatrixXd &A, base::MatrixXd &U, base::VectorXd &S, base::MatrixXd &V, base::VectorXd &tmp, int maxiter, double epsilon)
Definition SVD.cpp:5