OptCholesky.hh
Go to the documentation of this file.
1/*
2 * Copyright 2009, 2010,
3 *
4 * Andrei Herdt
5 * Francois Keith
6 * Olivier Stasse
7 *
8 * JRL, CNRS/AIST
9 *
10 * This file is part of walkGenJrl.
11 * walkGenJrl is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * walkGenJrl is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Lesser Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with walkGenJrl. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * Research carried out within the scope of the
24 * Joint Japanese-French Robotics Laboratory (JRL)
25 */
26/* \file Cholesky.h
27 \brief This object provides the Cholesky decomposition
28 of a symmetric positive-definite matrix.
29 This one is especially designed for QP resolution and handle constraints.
30*/
31
32#ifndef _CHOLESKY_DEC_H_
33#define _CHOLESKY_DEC_H_
34
35#include <vector>
36
37using namespace ::std;
38
39namespace PatternGeneratorJRL {
47class OptCholesky {
48 public:
55 OptCholesky(unsigned int lNbMaxOfConstraints, unsigned int lCardU,
56 unsigned int mode);
57
59 ~OptCholesky();
60
62 void SetA(double *aA, unsigned int lNbOfConstraints);
63
69 int AddActiveConstraints(vector<unsigned int> &lConstraints);
70
75 int AddActiveConstraint(unsigned int aConstraint);
76
79 std::size_t CurrentNumberOfRows();
80
82 int ComputeNormalCholeskyOnANormal();
83
85 int ComputeInverseCholeskyNormal(int mode);
86
88 void SetL(double *aL);
89
91 void SetiL(double *aiL);
92
94 void SetToZero();
95
97 void SetMode(unsigned int mode);
98
100 static const unsigned int MODE_NORMAL = 0;
101 static const unsigned int MODE_FORTRAN = 1;
102
103 private:
106 unsigned int m_NbMaxOfConstraints;
107
110 unsigned int m_CardU;
111
114 double *m_A;
115
118 double *m_L;
119
122 double *m_iL;
123
125 unsigned int m_UpdateMode;
126
128 unsigned int m_NbOfConstraints;
129
132 vector<unsigned int> m_SetActiveConstraints;
133
135 int UpdateCholeskyMatrixFortran();
136
138 int UpdateCholeskyMatrixNormal();
139
141 void FreeMemory();
142
144 void InitializeInternalVariables();
145};
146} // namespace PatternGeneratorJRL
147
148#endif /* _CHOLESKY_DEC_H_ */
\doc Simulate a rigid body
Definition: patterngeneratorinterface.hh:41