23 #ifndef O2SCL_JACOBIAN_H
24 #define O2SCL_JACOBIAN_H
31 #include <o2scl/mm_funct.h>
32 #include <o2scl/deriv_gsl.h>
33 #include <o2scl/columnify.h>
34 #include <o2scl/vector.h>
36 #ifndef DOXYGEN_NO_O2NS
41 typedef std::function<
81 virtual int operator()(
size_t nx, vec_t &x,
size_t ny, vec_t &y,
84 #ifndef DOXYGEN_INTERNAL
128 #ifndef DOXYGEN_INTERNAL
172 virtual int operator()(
size_t nx, vec_t &x,
size_t ny, vec_t &y,
203 if (temp!=0.0) nonzero=
true;
206 if (nonzero==
false) success=
false;
211 if (success==
false) {
213 "in jacobian_gsl::operator().",
exc_esing,
240 public jacobian<func_t,vec_t,mat_t> {
286 virtual int operator()(
size_t nx, vec_t &x,
size_t ny, vec_t &y,
299 this,std::placeholders::_1,std::ref(ejp));
301 for (
size_t j=0;j<nx;j++) {
303 for (
size_t i=0;i<ny;i++) {
305 double tmp=(*ejp.
x)[j];
314 #ifndef DOXYGEN_INTERNAL
324 (this->func)(ejp.
nx,*ejp.
x,*ejp.
y);
325 return (*ejp.
y)[ejp.
yi];
332 #ifndef DOXYGEN_NO_O2NS
virtual int operator()(size_t nx, vec_t &x, size_t ny, vec_t &y, mat_t &j)=0
Evaluate the Jacobian j at point y(x)
virtual int set_function(func_t &f)
Set the function to compute the Jacobian of.
size_t xj
The current x value.
std::function< double(double)> funct11
One-dimensional function typedef.
virtual int operator()(size_t nx, vec_t &x, size_t ny, vec_t &y, mat_t &jac)
The operator()
std::function< int(size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &) > mm_funct11
Array of multi-dimensional functions typedef.
apparent singularity detected
virtual double deriv(double x, func_t &func)
Calculate the first derivative of func w.r.t. x.
#define O2SCL_CONV2_RET(d, d2, n, b)
Set an error and return the error value, two-string version.
size_t mem_size_x
Size of allocated memory in x.
size_t yi
The current y value.
double h
Initial stepsize.
double epsrel
The relative stepsize for finite-differencing (default )
double dfn(double x, ej_parms &ejp)
Function for the derivative object.
virtual int operator()(size_t nx, vec_t &x, size_t ny, vec_t &y, mat_t &jac)
The operator()
Numerical differentiation base [abstract base].
bool err_nonconv
If true, call the error handler if the routine does not "converge".
size_t ny
The number of variables.
std::function< int(size_t, boost::numeric::ublas::vector< double > &, size_t, boost::numeric::ublas::vector< double > &, boost::numeric::ublas::matrix< double > &) > jac_funct11
Jacobian function (not necessarily square)
vec_t xx
Function arguments.
deriv_base * dptr
Pointer to the derivative object.
Numerical differentiation (GSL)
int set_deriv(deriv_base<> &de)
Set the derivative object.
func_t func
A pointer to the user-specified function.
size_t nx
The number of variables.
double epsmin
The minimum stepsize (default )
void vector_copy(vec_t &src, vec2_t &dest)
Simple generic vector copy.
deriv_gsl def_deriv
The default derivative object.
size_t mem_size_y
Size of allocated memory in y.
Parameter structure for passing information.
Simple automatic Jacobian.
Base for providing a numerical jacobian [abstract base].
A direct calculation of the jacobian using a deriv_base object.