o2scl::mroot_hybrids_base Class Reference

Base functions for mroot_hybrids. More...

#include <mroot_hybrids.h>

Inheritance diagram for o2scl::mroot_hybrids_base:

## Public Types

typedef boost::numeric::ublas::vector< double > ubvector

typedef boost::numeric::ublas::matrix< double > ubmatrix

## Public Member Functions

double compute_actual_reduction (double fnorm0, double fnorm1)
Compute the actual reduction.

double compute_predicted_reduction (double fnorm0, double fnorm1)
Compute the predicted reduction phi1p=|Q^T f + R dx|.

template<class vec2_t , class mat_t >
void compute_Rg (size_t N, const mat_t &r2, const ubvector &gradient2, vec2_t &Rg)
Compute where g is the gradient.

template<class vec2_t >
void compute_wv (size_t n, const ubvector &qtdf2, const ubvector &rdx2, const vec2_t &dx2, const ubvector &diag2, double pnorm, ubvector &w2, ubvector &v2)
Compute w and v.

template<class vec2_t , class mat_t >
void compute_rdx (size_t N, const mat_t &r2, const vec2_t &dx2, ubvector &rdx2)
Compute .

template<class vec2_t , class vec3_t >
double scaled_enorm (size_t n, const vec2_t &d, const vec3_t &ff)
Compute the norm of the vector defined by .

template<class vec2_t >
double compute_delta (size_t n, ubvector &diag2, vec2_t &x2)
Compute delta.

template<class vec2_t >
double enorm (size_t N, const vec2_t &ff)
Compute the Euclidean norm of ff. More...

double enorm_sum (size_t n, const ubvector &a, const ubvector &b)
Compute the Euclidean norm of the sum of a and b.

template<class vec2_t >
int compute_trial_step (size_t N, vec2_t &xl, vec2_t &dxl, vec2_t &xx_trial)
Compute a trial step and put the result in xx_trial. More...

template<class vec2_t >
int compute_df (size_t n, const vec2_t &ff_trial, const vec2_t &fl, ubvector &dfl)
Compute the change in the function value. More...

template<class mat2_t >
void compute_diag (size_t n, const mat2_t &J2, ubvector &diag2)
Compute diag, the norm of the columns of the Jacobian.

template<class vec2_t , class vec3_t , class vec4_t >
void compute_qtf (size_t N, const vec2_t &q2, const vec3_t &f2, vec4_t &qtf2)
Compute . More...

template<class mat2_t >
void update_diag (size_t n, const mat2_t &J2, ubvector &diag2)
Update diag.

template<class vec2_t >
void scaled_addition (size_t N, double alpha, ubvector &newton2, double beta, ubvector &gradient2, vec2_t &pp)
Form appropriate convex combination of the Gauss-Newton direction and the scaled gradient direction. More...

template<class mat_t >
int newton_direction (const size_t N, const mat_t &r2, const ubvector &qtf2, ubvector &p)
Compute the Gauss-Newton direction.

template<class mat_t >
void gradient_direction (const size_t M, const size_t N, const mat_t &r2, const ubvector &qtf2, const ubvector &diag2, ubvector &g)

void minimum_step (const size_t N, double gnorm, const ubvector &diag2, ubvector &g)
Compute the point at which the gradient is minimized.

template<class vec2_t , class mat_t >
int dogleg (size_t n, const mat_t &r2, const ubvector &qtf2, const ubvector &diag2, double delta2, ubvector &newton2, ubvector &gradient2, vec2_t &p)
Take a dogleg step. More...

## Detailed Description

Definition at line 73 of file mroot_hybrids.h.

## ◆ compute_df()

template<class vec2_t >
 int o2scl::mroot_hybrids_base::compute_df ( size_t n, const vec2_t & ff_trial, const vec2_t & fl, ubvector & dfl )
inline
Idea for Future:
Replace with daxpy?

Definition at line 215 of file mroot_hybrids.h.

## ◆ compute_qtf()

template<class vec2_t , class vec3_t , class vec4_t >
 void o2scl::mroot_hybrids_base::compute_qtf ( size_t N, const vec2_t & q2, const vec3_t & f2, vec4_t & qtf2 )
inline
Idea for Future:
This is just right-multiplication, so we could use the O2scl cblas routines instead.

Definition at line 248 of file mroot_hybrids.h.

## ◆ compute_trial_step()

template<class vec2_t >
 int o2scl::mroot_hybrids_base::compute_trial_step ( size_t N, vec2_t & xl, vec2_t & dxl, vec2_t & xx_trial )
inline
Idea for Future:
Replace with daxpy.

Definition at line 202 of file mroot_hybrids.h.

## ◆ dogleg()

template<class vec2_t , class mat_t >
 int o2scl::mroot_hybrids_base::dogleg ( size_t n, const mat_t & r2, const ubvector & qtf2, const ubvector & diag2, double delta2, ubvector & newton2, ubvector & gradient2, vec2_t & p )
inline

Given the QR decomposition of an n by n matrix "A", a diagonal matrix diag, a vector b, and a positive number delta, this function determines the convex combination x of the Gauss-Newton and scaled gradient directions which minimizes in the least squares sense, subject to the restriction that the Euclidean norm of is smaller than the value of delta.

Definition at line 361 of file mroot_hybrids.h.

## ◆ enorm()

template<class vec2_t >
 double o2scl::mroot_hybrids_base::enorm ( size_t N, const vec2_t & ff )
inline
Idea for Future:
Replace this with dnrm2 from cblas_base.h

Definition at line 177 of file mroot_hybrids.h.

Using the Gauss-Newton direction given in newton (a vector of size N), and the gradient direction in gradient (also a vector of size N), this computes