KrisLibrary  1.0.0
sparsefunction.h
Go to the documentation of this file.
1 #ifndef MATH_SPARSE_FUNCTION_H
2 #define MATH_SPARSE_FUNCTION_H
3 
4 #include "function.h"
5 #include "sparsematrix.h"
6 #include "sparsevector.h"
7 
13 namespace Math {
14 
17 
22 {
23 public:
24  virtual void Jacobian(const Vector& x,Matrix& J) {
25  SparseMatrix sJ(J.m,J.n);
26  Jacobian_Sparse(x,sJ);
27  sJ.get(J);
28  }
29  virtual void Jacobian_i(const Vector& x,int i,Vector& Ji) {
30  SparseVector sJi(Ji.n);
31  Jacobian_i_Sparse(x,i,sJi);
32  sJi.get(Ji);
33  }
34  virtual void Hessian_i(const Vector& x,int i,Matrix& Hi) {
35  SparseMatrix sHi(Hi.m,Hi.n);
36  Hessian_i_Sparse(x,i,sHi);
37  sHi.get(Hi);
38  }
39  virtual void Jacobian_Sparse(const Vector& x,SparseMatrix& J)=0;
40  virtual void Jacobian_i_Sparse(const Vector& x,int i,SparseVector& Ji)=0;
41  virtual void Hessian_i_Sparse(const Vector& x,int i,SparseMatrix& Hi) {
42  FatalError("Hessian_i_Sparse() not defined in subclass of SparseVectorFunction");
43  }
44 };
45 
46 } //namespace Math
47 
48 #endif
Abstract base classes for function interfaces.
A function from R^n to R^m.
Definition: function.h:134
Definition: SparseVectorTemplate.h:14
A vector field function with a sparse jacobian. The Jacobian_Sparse and Jacobian_i_Sparse methods mus...
Definition: sparsefunction.h:21
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12