MADNESS  0.10.1
Public Member Functions | Public Attributes | Private Attributes | List of all members
madness::XNonlinearSolver< T, C, Alloc > Class Template Reference

Generalized version of NonlinearSolver not limited to a single madness function. More...

#include <nonlinsol.h>

Collaboration diagram for madness::XNonlinearSolver< T, C, Alloc >:
Collaboration graph
[legend]

Public Member Functions

 XNonlinearSolver (const Alloc &alloc=Alloc(), bool print=false)
 
 XNonlinearSolver (const XNonlinearSolver &other)
 
void clear_subspace ()
 
Tensor< Cget_c () const
 
std::vector< T > & get_rlist ()
 
std::vector< T > & get_ulist ()
 
void set_maxsub (int maxsub)
 
T update (const T &u, const T &r, const double rcondtol=1e-8, const double cabsmax=1000.0)
 Computes next trial solution vector. More...
 

Public Attributes

bool do_print
 

Private Attributes

Alloc alloc
 
Tensor< Cc
 coefficients for linear combination More...
 
unsigned int maxsub
 Maximum size of subspace dimension. More...
 
Tensor< CQ
 
std::vector< Trlist
 Subspace information. More...
 
std::vector< Tulist
 

Detailed Description

template<class T, class C = double, class Alloc = default_allocator<T>>
class madness::XNonlinearSolver< T, C, Alloc >

Generalized version of NonlinearSolver not limited to a single madness function.

This solves the equation $r(u) = 0$ where u and r are both of type T and inner products between two items of type T produce a number of type C (defaulting to double). The type T must support storage in an STL vector, scaling by a constant of type C, inplace addition (+=), subtraction, allocation with value zero, and inner products computed with the interface inner(a,b). Have a look in examples/testsolver.cc for a simple but complete example, and in examples/h2dynamic.cc for a more complex example.

I've not yet tested with anything except C=double and I think that the KAIN routine will need extending for anything else.

Constructor & Destructor Documentation

◆ XNonlinearSolver() [1/2]

template<class T , class C = double, class Alloc = default_allocator<T>>
madness::XNonlinearSolver< T, C, Alloc >::XNonlinearSolver ( const Alloc &  alloc = Alloc(),
bool  print = false 
)
inline

◆ XNonlinearSolver() [2/2]

template<class T , class C = double, class Alloc = default_allocator<T>>
madness::XNonlinearSolver< T, C, Alloc >::XNonlinearSolver ( const XNonlinearSolver< T, C, Alloc > &  other)
inline

Member Function Documentation

◆ clear_subspace()

template<class T , class C = double, class Alloc = default_allocator<T>>
void madness::XNonlinearSolver< T, C, Alloc >::clear_subspace ( )
inline

◆ get_c()

template<class T , class C = double, class Alloc = default_allocator<T>>
Tensor<C> madness::XNonlinearSolver< T, C, Alloc >::get_c ( ) const
inline

◆ get_rlist()

template<class T , class C = double, class Alloc = default_allocator<T>>
std::vector<T>& madness::XNonlinearSolver< T, C, Alloc >::get_rlist ( )
inline

◆ get_ulist()

template<class T , class C = double, class Alloc = default_allocator<T>>
std::vector<T>& madness::XNonlinearSolver< T, C, Alloc >::get_ulist ( )
inline

◆ set_maxsub()

template<class T , class C = double, class Alloc = default_allocator<T>>
void madness::XNonlinearSolver< T, C, Alloc >::set_maxsub ( int  maxsub)
inline

◆ update()

template<class T , class C = double, class Alloc = default_allocator<T>>
T madness::XNonlinearSolver< T, C, Alloc >::update ( const T u,
const T r,
const double  rcondtol = 1e-8,
const double  cabsmax = 1000.0 
)
inline

Computes next trial solution vector.

You are responsible for performing step restriction or line search (not necessary for linear problems).

Parameters
uCurrent solution vector
rCorresponding residual
Returns
Next trial solution vector
Parameters
[in]rcondtolrcond less than this will cause the subspace to be shrunk due to linear dependence
[in]cabsmaxmaximum element of c greater than this will cause the subspace to be shrunk due to li

References madness::XNonlinearSolver< T, C, Alloc >::alloc, madness::XNonlinearSolver< T, C, Alloc >::c, madness::check_linear_dependence(), madness::copy(), madness::XNonlinearSolver< T, C, Alloc >::do_print, madness::inner(), madness::KAIN(), madness::XNonlinearSolver< T, C, Alloc >::maxsub, madness::print(), madness::XNonlinearSolver< T, C, Alloc >::Q, madness::XNonlinearSolver< T, C, Alloc >::rlist, T(), u(), and madness::XNonlinearSolver< T, C, Alloc >::ulist.

Referenced by iterate(), madness::Zcis::iterate(), and madness::PNO::t_solve().

Member Data Documentation

◆ alloc

template<class T , class C = double, class Alloc = default_allocator<T>>
Alloc madness::XNonlinearSolver< T, C, Alloc >::alloc
private

◆ c

template<class T , class C = double, class Alloc = default_allocator<T>>
Tensor<C> madness::XNonlinearSolver< T, C, Alloc >::c
private

◆ do_print

template<class T , class C = double, class Alloc = default_allocator<T>>
bool madness::XNonlinearSolver< T, C, Alloc >::do_print

◆ maxsub

template<class T , class C = double, class Alloc = default_allocator<T>>
unsigned int madness::XNonlinearSolver< T, C, Alloc >::maxsub
private

◆ Q

template<class T , class C = double, class Alloc = default_allocator<T>>
Tensor<C> madness::XNonlinearSolver< T, C, Alloc >::Q
private

◆ rlist

template<class T , class C = double, class Alloc = default_allocator<T>>
std::vector<T> madness::XNonlinearSolver< T, C, Alloc >::rlist
private

◆ ulist

template<class T , class C = double, class Alloc = default_allocator<T>>
std::vector<T> madness::XNonlinearSolver< T, C, Alloc >::ulist
private

The documentation for this class was generated from the following file: