CoolProp  4.2.5
An open-source fluid property and humid air property database
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Solvers.h
Go to the documentation of this file.
1 
2 
3 #ifndef SOLVERS_H
4 #define SOLVERS_H
5 
6 #include <vector>
7 #include <string>
8 #include "CPExceptions.h"
9 
11 {
12 public:
14  virtual ~FuncWrapper1D(){};
15  virtual double call(double) = 0;
16  virtual double deriv(double){throw NotImplementedError("deriv function not implemented");};
17 };
18 
20 {
21 public:
23  virtual ~FuncWrapperND(){};
24  virtual std::vector<double> call(std::vector<double>) = 0;// must be provided
25  virtual std::vector<std::vector<double> > Jacobian(std::vector<double>);
26 };
27 
28 // Single-Dimensional solvers
29 double Brent(FuncWrapper1D *f, double a, double b, double macheps, double t, int maxiter, std::string *errstr);
30 double Secant(FuncWrapper1D *f, double x0, double dx, double ftol, int maxiter, std::string *errstring);
31 double BoundedSecant(FuncWrapper1D *f, double x0, double xmin, double xmax, double dx, double ftol, int maxiter, std::string *errstring);
32 double Newton(FuncWrapper1D *f, double x0, double ftol, int maxiter, std::string *errstring);
33 
34 // Multi-Dimensional solvers
35 std::vector<double> NDNewtonRaphson_Jacobian(FuncWrapperND *f, std::vector<double> x0, double tol, int maxiter, std::string *errstring);
36 #endif
double Brent(FuncWrapper1D *f, double a, double b, double macheps, double t, int maxiter, std::string *errstr)
Definition: Solvers.cpp:235
double BoundedSecant(FuncWrapper1D *f, double x0, double xmin, double xmax, double dx, double ftol, int maxiter, std::string *errstring)
Definition: Solvers.cpp:179
std::vector< double > NDNewtonRaphson_Jacobian(FuncWrapperND *f, std::vector< double > x0, double tol, int maxiter, std::string *errstring)
Definition: Solvers.cpp:47
FuncWrapper1D()
Definition: Solvers.h:13
virtual double call(double)=0
double Secant(FuncWrapper1D *f, double x0, double dx, double ftol, int maxiter, std::string *errstring)
Definition: Solvers.cpp:123
double Newton(FuncWrapper1D *f, double x0, double ftol, int maxiter, std::string *errstring)
Definition: Solvers.cpp:85
virtual double deriv(double)
Definition: Solvers.h:16
virtual std::vector< double > call(std::vector< double >)=0
virtual ~FuncWrapperND()
Definition: Solvers.h:23
FuncWrapperND()
Definition: Solvers.h:22
virtual std::vector< std::vector< double > > Jacobian(std::vector< double >)
Definition: Solvers.cpp:8
virtual ~FuncWrapper1D()
Definition: Solvers.h:14