Class documentation of Concepts

Loading...
Searching...
No Matches

#include <newton.hh>

Inheritance diagram for concepts::Newton< F >:
concepts::VecOperator< F::d_type > concepts::Operator< F > concepts::OutputOperator

Public Types

typedef Realtype< F >::type r_type
 Real type of data type.
 
typedef Cmplxtype< F >::type c_type
 Real type of data type.
 

Public Member Functions

 Newton (std::function< Vector< typename F::d_type >(Vector< typename F::d_type >)> A, Real dx, uint dimY, uint dimX, Real tol=1e-8, Real iterMax=1000)
 
 Newton (std::function< Vector< typename F::d_type >(Vector< typename F::d_type >)> A, std::function< F(Vector< typename F::d_type >)> JacA, uint dimY, uint dimX, Real tol=1e-8, Real iterMax=50)
 
virtual void show_messages ()
 
virtual void hide_messages ()
 
virtual void apply_ (const Vector< typename F::d_type > &fncY, Vector< typename F::d_type > &fncX)
 
virtual void apply_ ()
 
virtual void operator() (const Function< r_type > &fncY, Function< F > &fncX)
 
virtual void operator() (const Function< c_type > &fncY, Function< c_type > &fncX)
 
virtual void operator() (const Vector< r_type > &fncY, Vector< F > &fncX)
 
virtual void operator() (const Vector< c_type > &fncY, Vector< c_type > &fncX)
 
void operator() (const Matrix< r_type > &mX, Matrix< F > &mY)
 Application method to real matrices. Calls function apply()
 
void operator() (const Matrix< c_type > &mX, Matrix< c_type > &mY)
 Application method to complex matrices. Calls apply_()
 
void operator() ()
 Application method without second argument. Used for parallel solvers.
 
virtual void operator() (const Function< r_type > &fncY, Function< F > &fncX)
 
virtual const uint dimX () const
 
virtual const uint dimY () const
 

Public Attributes

F::d_type type
 

Protected Member Functions

virtual void setLinearSolver_ (F *Jacobian)
 Set linear solver.
 
virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.
 
virtual void apply_ (const Vector< F > &fncY, Vector< F > &fncX)=0
 

Protected Attributes

std::function< Vector< typename F::d_type >(Vector< typename F::d_type >)> & A_
 Function that evaluates the matrix A applied to vector X.
 
std::function< F(Vector< typename F::d_type >)> * JacA_
 Function that evaluates the Jacobian of matrix A applied to vector X.
 
bool definedJacA_
 Flag that states if the Jacobian matrix has been set.
 
Real dx_
 Step for the computation of the pseudo-Jacobian.
 
uint dimY_
 Size of the data.
 
uint dimX_
 Size of the unknown.
 
Real tol_
 Tolerance for the functional.
 
uint iterMax_
 Maximum number of iterations.
 
bool verbose_
 Internal flag for verbosity.
 
std::unique_ptr< concepts::Operator< typename F::d_type > > linearSolver_
 Internal linear solver.
 

Detailed Description

template<class F>
class concepts::Newton< F >

Solves a non-linear system of the form A(X)=Y

Definition at line 35 of file newton.hh.

Member Typedef Documentation

◆ c_type

typedef Cmplxtype<F>::type concepts::VecOperator< F >::c_type
inherited

Real type of data type.

Definition at line 120 of file compositions.hh.

◆ r_type

typedef Realtype<F>::type concepts::VecOperator< F >::r_type
inherited

Real type of data type.

Definition at line 118 of file compositions.hh.

Constructor & Destructor Documentation

◆ Newton() [1/2]

template<class F >
concepts::Newton< F >::Newton ( std::function< Vector< typename F::d_type >(Vector< typename F::d_type >)>  A,
Real  dx,
uint  dimY,
uint  dimX,
Real  tol = 1e-8,
Real  iterMax = 1000 
)
inline

Constructor

Parameters
Anon-linear operator that has to be solved
dimYsize of the data
dimXsize of the unknown
dxstep for the algorithm
tol(optional) tolerance that will be used for the algorithm
iterMax(optional) maximum number of iterations before the algorithm decides failure

Definition at line 51 of file newton.hh.

◆ Newton() [2/2]

template<class F >
concepts::Newton< F >::Newton ( std::function< Vector< typename F::d_type >(Vector< typename F::d_type >)>  A,
std::function< F(Vector< typename F::d_type >)>  JacA,
uint  dimY,
uint  dimX,
Real  tol = 1e-8,
Real  iterMax = 50 
)
inline

Constructor

Parameters
Anon-linear operator that has to be solved
JacAJacobian of the non-linear operator A
dimYsize of the data
dimXsize of the unknown
dxstep for the algorithm
tol(optional) tolerance that will be used for the algorithm
iterMax(optional) maximum number of iterations before the algorithm decides failure

Definition at line 67 of file newton.hh.

◆ ~Newton()

template<class F >
virtual concepts::Newton< F >::~Newton ( )
inlinevirtual

Definition at line 75 of file newton.hh.

Member Function Documentation

◆ apply_() [1/2]

template<class F >
virtual void concepts::Newton< F >::apply_ ( )
virtual

Intrinsic application method without argument

Implements concepts::VecOperator< F::d_type >.

◆ apply_() [2/2]

virtual void concepts::VecOperator< F >::apply_ ( const Vector< F > &  fncY,
Vector< F > &  fncX 
)
protectedpure virtualinherited

Intrinsic application method, i.e. real Operator and real Vector or complex Operator and real Vector.

◆ dimX()

template<class F >
virtual const uint concepts::Operator< F >::dimX ( ) const
inlinevirtualinherited

Returns the size of the image space of the operator (number of rows of the corresponding matrix)

Examples
hpFEM2d-simple.cc, hpFEM2d.cc, and matfileTutorial.cc.

Definition at line 93 of file compositions.hh.

◆ dimY()

template<class F >
virtual const uint concepts::Operator< F >::dimY ( ) const
inlinevirtualinherited

Returns the size of the source space of the operator (number of columns of the corresponding matrix)

Examples
matfileTutorial.cc.

Definition at line 98 of file compositions.hh.

◆ info()

virtual std::ostream & concepts::VecOperator< F >::info ( std::ostream &  os) const
protectedvirtualinherited

Returns information in an output stream.

Reimplemented from concepts::Operator< F >.

◆ operator()() [1/5]

void concepts::VecOperator< F >::operator() ( )
virtualinherited

Application method without second argument. Used for parallel solvers.

Reimplemented from concepts::Operator< F >.

◆ operator()() [2/5]

virtual void concepts::VecOperator< F >::operator() ( const Function< c_type > &  fncY,
Function< c_type > &  fncX 
)
virtualinherited

Application operator for complex function fncY.

Computes fncX = A(fncY) where A is this operator. fncX becomes complex.

In derived classes its enough to implement the operator() for complex Operator's. If a real counterpart is not implemented, the function fncY is splitted into real and imaginary part and the application operator for real functions is called for each. Then the result is combined.

If in a derived class the operator() for complex Operator's is not implemented, a exception is thrown from here.

Reimplemented from concepts::Operator< F >.

◆ operator()() [3/5]

template<class F >
virtual void concepts::Operator< F >::operator() ( const Function< r_type > &  fncY,
Function< F > &  fncX 
)
virtualinherited

Application operator for real function fncY.

Computes fncX = A(fncY) where A is this operator.

fncX becomes the type of the operator, for real data it becomes real, for complex data it becomes complex.

In derived classes its enough to implement the operator() for real Operator's. If a complex counterpart is not implemented, the function fncY is transformed to a complex function and then the application operator for complex functions is called.

If in a derived class the operator() for real Operator's is not implemented, a exception is thrown from here.

Reimplemented in aglowav::C2W< F >, aglowav2::C2W< F >, aglowav::W2C< F >, aglowav2::W2C< F >, aglowav::C2_tl2< F >, aglowav::C2tl2< F >, aglowav::CGt2< F >, aglowav::ComposeN< F >, aglowav2::Operator00< F >, bem::D< F >, bem::D_1< F >, concepts::TrivExtendRestrict< F >, sparseqr::GivensRotations< F >, vectorial::BlockOperator< F >, concepts::TrivExtendRestrict< Real >, sparseqr::GivensRotations< Real >, concepts::AfterIteration< F >, concepts::Compose< F, H >, concepts::DDSolver< F, G >, concepts::Multiple< F >, concepts::LiCoI< F >, concepts::LiCo< F >, concepts::DenseMatrix< F >, concepts::DiagonalMatrix< F >, concepts::Permutation< F >, concepts::Matrix< F >, concepts::Matrix< F::type >, and concepts::DiagonalSolver< F >.

◆ operator()() [4/5]

virtual void concepts::VecOperator< F >::operator() ( const Vector< c_type > &  fncY,
Vector< c_type > &  fncX 
)
virtualinherited

Application operator for complex function fncY.

Computes fncX = A(fncY) where A is this operator. fncX becomes complex.

In derived classes its enough to implement the operator() for complex Operator's. If a real counterpart is not implemented, the vector fncY is splitted into real and imaginary part and the application operator for real vectors is called for each. Then the result is combined

If in a derived class the operator() for complex Operator's i not implemented, a exception is thrown from here.

◆ operator()() [5/5]

virtual void concepts::VecOperator< F >::operator() ( const Vector< r_type > &  fncY,
Vector< F > &  fncX 
)
virtualinherited

Application operator for real vector fncY.

Computes fncX = A(fncY) where A is this operator.

Type of fncX becomes that of the operator, for real data it becomes real, for complex data it becomes complex.

In derived classes its enough to implement the operator() for real Operator's. If a complex counterpart is not implemented, the vector fncY is transformed to a complex vector and then the application for complex vectors is called.

If in a derived class the operator() for real Operator's is not implemented, a exception is thrown from here.

◆ show_messages()

template<class F >
virtual void concepts::Newton< F >::show_messages ( )
virtual

Reimplemented from concepts::Operator< F >.

Member Data Documentation

◆ A_

template<class F >
std::function<Vector<typename F::d_type>(Vector<typename F::d_type>)>& concepts::Newton< F >::A_
protected

Function that evaluates the matrix A applied to vector X.

Definition at line 92 of file newton.hh.

◆ definedJacA_

template<class F >
bool concepts::Newton< F >::definedJacA_
protected

Flag that states if the Jacobian matrix has been set.

Definition at line 100 of file newton.hh.

◆ dimX_

template<class F >
uint concepts::Newton< F >::dimX_
protected

Size of the unknown.

Definition at line 109 of file newton.hh.

◆ dimY_

template<class F >
uint concepts::Newton< F >::dimY_
protected

Size of the data.

Definition at line 106 of file newton.hh.

◆ dx_

template<class F >
Real concepts::Newton< F >::dx_
protected

Step for the computation of the pseudo-Jacobian.

Definition at line 103 of file newton.hh.

◆ iterMax_

template<class F >
uint concepts::Newton< F >::iterMax_
protected

Maximum number of iterations.

Definition at line 115 of file newton.hh.

◆ JacA_

template<class F >
std::function<F(Vector<typename F::d_type>)>* concepts::Newton< F >::JacA_
protected

Function that evaluates the Jacobian of matrix A applied to vector X.

Definition at line 95 of file newton.hh.

◆ linearSolver_

template<class F >
std::unique_ptr<concepts::Operator<typename F::d_type> > concepts::Newton< F >::linearSolver_
protected

Internal linear solver.

Definition at line 121 of file newton.hh.

◆ tol_

template<class F >
Real concepts::Newton< F >::tol_
protected

Tolerance for the functional.

Definition at line 112 of file newton.hh.

◆ type

template<class F >
F::d_type concepts::Newton< F >::type

Definition at line 39 of file newton.hh.

◆ verbose_

template<class F >
bool concepts::Newton< F >::verbose_
protected

Internal flag for verbosity.

Definition at line 118 of file newton.hh.


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