ConstraintTools.hh 2.63 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//=============================================================================
//
//  CLASS CoonstraintTools
//
//=============================================================================


#ifndef COMISO_CONSTRAINTTOOLS_HH
#define COMISO_CONSTRAINTTOOLS_HH


//== COMPILE-TIME PACKAGE REQUIREMENTS ========================================
#include <CoMISo/Config/config.hh>
#if COMISO_EIGEN3_AVAILABLE

//== INCLUDES =================================================================

#include <stdio.h>
#include <iostream>
#include <vector>

22
#include <CoMISo/Utils/gmm.h>
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

#include <CoMISo/Config/CoMISoDefines.hh>
#include <CoMISo/NSolver/NConstraintInterface.hh>

//== FORWARDDECLARATIONS ======================================================

//== NAMESPACES ===============================================================

namespace COMISO {

//== CLASS DEFINITION =========================================================

	      

/** \class ConstraintTools ConstraintTools.hh <CoMISo/NSolver/ConstraintTools.hh>
  
    A more elaborate description follows.
*/
class COMISODLLEXPORT ConstraintTools
{
public:
  
  // gmm types
  typedef gmm::wsvector<double>         SVectorGMM;
  typedef gmm::row_matrix< SVectorGMM > RMatrixGMM;
  typedef gmm::col_matrix< SVectorGMM > CMatrixGMM;

  // remove all linear dependent linear equality constraints. the remaining constraints are a subset of the original ones
  // nonlinear or equality constraints are preserved.
  static void remove_dependent_linear_constraints(std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8);

  // same as above but assumes already that all constraints are linear equality constraints
Max Lyon's avatar
Max Lyon committed
55
  static void remove_dependent_linear_constraints_only_linear_equality(std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8);
56
57
58

private:

Max Lyon's avatar
Max Lyon committed
59
  static gmm::size_type find_max_abs_coeff(SVectorGMM& _v);
60

Max Lyon's avatar
Max Lyon committed
61
  static void add_row_simultaneously( gmm::size_type _row_i,
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
                                      double      _coeff,
                                      SVectorGMM& _row,
                                      RMatrixGMM& _rmat,
                                      CMatrixGMM& _cmat,
                                      const double _eps );


};


//=============================================================================
} // namespace COMISO
//=============================================================================
#endif // COMISO_EIGEN3_AVAILABLE
//=============================================================================
#endif // COMISO_CONSTRAINTTOOLS_HH defined
//=============================================================================