LinearProblem.hh 2.27 KB
Newer Older
David Bommes's avatar
David Bommes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//=============================================================================
//
//  CLASS LinearProblem
//
//=============================================================================


#ifndef COMISO_LINEARPROBLEM_HH
#define COMISO_LINEARPROBLEM_HH


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

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

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

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

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

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

namespace COMISO {

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

	      

/** \class LinearProblem LinearProblem.hh <CoMISo/NSolver/LinearProblem.hh>

    Brief Description.
  
    A more elaborate description follows.
*/
class COMISODLLEXPORT LinearProblem : public NProblemInterface
{
public:
  
  /// Default constructor
Andreas Fabri's avatar
Andreas Fabri committed
46
  LinearProblem (std::size_t _dimension = 0);
David Bommes's avatar
David Bommes committed
47 48
 
  // problem definition
Andreas Fabri's avatar
Andreas Fabri committed
49
  virtual int    n_unknowns();
50 51 52 53 54 55 56 57 58 59

  virtual void   initial_x(double* _x);

  virtual double eval_f( const double* _x);

  virtual void   eval_gradient( const double* _x, double* _g);

  virtual void   eval_hessian ( const double* _x, SMatrixNP& _H);

  virtual void   store_result ( const double* _x );
David Bommes's avatar
David Bommes committed
60 61

  // advanced properties
62 63
  virtual bool   constant_gradient() const;
  virtual bool   constant_hessian()  const;
David Bommes's avatar
David Bommes committed
64 65

  // give access to coefficients to define the problem
66
  std::vector<double>& coeffs();
David Bommes's avatar
David Bommes committed
67 68

  // give access to result
69
  std::vector<double>& x();
David Bommes's avatar
David Bommes committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86

private:

  // coefficients of linear problem
  std::vector<double> coeffs_;
  std::vector<double> x_;
};


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