NProblemInterface.hh 2.75 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
//=============================================================================
//
David Bommes's avatar
David Bommes committed
3
//  CLASS NProblemInterface
David Bommes's avatar
David Bommes committed
4
5
6
7
8
9
10
11
//
//=============================================================================


#ifndef COMISO_NPROBLEMINTERFACE_HH
#define COMISO_NPROBLEMINTERFACE_HH


12
13
//== COMPILE-TIME PACKAGE REQUIREMENTS ========================================
#include <CoMISo/Config/config.hh>
David Bommes's avatar
David Bommes committed
14
#if COMISO_EIGEN3_AVAILABLE
15

David Bommes's avatar
David Bommes committed
16
17
//== INCLUDES =================================================================

Max Lyon's avatar
Max Lyon committed
18
#include <Base/Code/Quality.hh>
David Bommes's avatar
David Bommes committed
19
#include <iostream>
20
#include <cfloat>
21

Max Lyon's avatar
Max Lyon committed
22
LOW_CODE_QUALITY_SECTION_BEGIN
David Bommes's avatar
David Bommes committed
23
24
25
26
#include <Eigen/Eigen>
#if !(EIGEN_VERSION_AT_LEAST(3,1,0))
  #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#endif
David Bommes's avatar
David Bommes committed
27
#include <Eigen/Sparse>
Max Lyon's avatar
Max Lyon committed
28
LOW_CODE_QUALITY_SECTION_END
David Bommes's avatar
David Bommes committed
29

David Bommes's avatar
David Bommes committed
30
31
#include <CoMISo/Config/CoMISoDefines.hh>

David Bommes's avatar
David Bommes committed
32
33
34
35
36
37
38
39
40
41
//== FORWARDDECLARATIONS ======================================================

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

namespace COMISO {

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

	      

David Bommes's avatar
David Bommes committed
42
/** \class NProblemInterface NProblemGmmInterface.hh <COMISO/NSolver/NPRoblemInterface.hh>
David Bommes's avatar
David Bommes committed
43
44
45
46
47

    Brief Description.
  
    A more elaborate description follows.
*/
David Bommes's avatar
David Bommes committed
48
class COMISODLLEXPORT NProblemInterface
David Bommes's avatar
David Bommes committed
49
50
{
public:
51

David Bommes's avatar
David Bommes committed
52
  // Sparse Matrix Type
53
 #if EIGEN_VERSION_AT_LEAST(3,1,0)  
David Bommes's avatar
David Bommes committed
54
  typedef Eigen::SparseMatrix<double,Eigen::ColMajor> SMatrixNP;
55
 #else
David Bommes's avatar
David Bommes committed
56
  typedef Eigen::DynamicSparseMatrix<double,Eigen::ColMajor> SMatrixNP;
57
 #endif
David Bommes's avatar
David Bommes committed
58
  
David Bommes's avatar
David Bommes committed
59
  /// Default constructor
60
  NProblemInterface();
David Bommes's avatar
David Bommes committed
61
62
 
  /// Destructor
63
  virtual ~NProblemInterface();
David Bommes's avatar
David Bommes committed
64

David Bommes's avatar
David Bommes committed
65
  // problem definition
David Bommes's avatar
David Bommes committed
66
67
68
69
70
71
  virtual int    n_unknowns   (                                ) = 0;
  virtual void   initial_x    (       double* _x               ) = 0;
  virtual double eval_f       ( const double* _x               ) = 0;
  virtual void   eval_gradient( const double* _x, double*    _g) = 0;
  virtual void   eval_hessian ( const double* _x, SMatrixNP& _H) = 0;
  virtual void   store_result ( const double* _x               ) = 0;
David Bommes's avatar
David Bommes committed
72
73

  // advanced properties
74
75
  virtual bool   constant_gradient ()                                    const { return false; }
  virtual bool   constant_hessian  ()                                    const { return false; }
76
  virtual double max_feasible_step ( const double* _x, const double* _v)       { return DBL_MAX; }
David Bommes's avatar
David Bommes committed
77
78
79
80
81
82
};


//=============================================================================
} // namespace COMISO
//=============================================================================
David Bommes's avatar
David Bommes committed
83
#endif // COMISO_EIGEN3_AVAILABLE
84
//=============================================================================
David Bommes's avatar
David Bommes committed
85
86
87
#endif // COMISO_NPROBLEMGMMINTERFACE_HH defined
//=============================================================================