OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    math_FunctionSetRoot Class Reference

    The math_FunctionSetRoot class calculates the root of a set of N functions of M variables (N<M, N=M or N>M). Knowing an initial guess of the solution and using a minimization algorithm, a search is made in the Newton direction and then in the Gradient direction if there is no success in the Newton direction. This algorithm can also be used for functions minimization. Knowledge of all the partial derivatives (the Jacobian) is required. More...

    #include <math_FunctionSetRoot.hxx>

    Public Member Functions

     math_FunctionSetRoot (math_FunctionSetWithDerivatives &F, const math_Vector &Tolerance, const int NbIterations=100)
     is used in a sub-class to initialize correctly all the fields of this class. The range (1, F.NbVariables()) must be especially respected for all vectors and matrix declarations.
     math_FunctionSetRoot (math_FunctionSetWithDerivatives &F, const int NbIterations=100)
     is used in a sub-class to initialize correctly all the fields of this class. The range (1, F.NbVariables()) must be especially respected for all vectors and matrix declarations. The method SetTolerance must be called after this constructor.
    virtual ~math_FunctionSetRoot ()
     Destructor.
    void SetTolerance (const math_Vector &Tolerance)
     Initializes the tolerance values.
    virtual bool IsSolutionReached (math_FunctionSetWithDerivatives &)
     This routine is called at the end of each iteration to check if the solution was found. It can be redefined in a sub-class to implement a specific test to stop the iterations. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.
    void Perform (math_FunctionSetWithDerivatives &theFunction, const math_Vector &theStartingPoint, const bool theStopOnDivergent=false)
     Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1)(j) <= Tolerance(j) for all unknowns.
    void Perform (math_FunctionSetWithDerivatives &theFunction, const math_Vector &theStartingPoint, const math_Vector &theInfBound, const math_Vector &theSupBound, const bool theStopOnDivergent=false)
     Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.
    bool IsDone () const
     Returns true if the computations are successful, otherwise returns false.
    int NbIterations () const
     Returns the number of iterations really done during the computation of the root. Exception NotDone is raised if the root was not found.
    int StateNumber () const
     returns the stateNumber (as returned by F.GetStateNumber()) associated to the root found.
    const math_VectorRoot () const
     Returns the value of the root of function F. Exception NotDone is raised if the root was not found.
    void Root (math_Vector &Root) const
     Outputs the root vector in Root. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the range of Root is not equal to the range of the StartingPoint.
    const math_MatrixDerivative () const
     Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.
    void Derivative (math_Matrix &Der) const
     outputs the matrix value of the derivative at the root in Der. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the column range of <Der> is not equal to the range of the startingPoint.
    const math_VectorFunctionSetErrors () const
     returns the vector value of the error done on the functions at the root. Exception NotDone is raised if the root was not found.
    void FunctionSetErrors (math_Vector &Err) const
     outputs the vector value of the error done on the functions at the root in Err. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the range of Err is not equal to the range of the StartingPoint.
    void Dump (Standard_OStream &o) const
     Prints on the stream o information on the current state of the object. Is used to redefine the operator <<.
    bool IsDivergent () const

    Protected Attributes

    math_Vector Delta
    math_Vector Sol
    math_Matrix DF
    math_Vector Tol

    Detailed Description

    The math_FunctionSetRoot class calculates the root of a set of N functions of M variables (N<M, N=M or N>M). Knowing an initial guess of the solution and using a minimization algorithm, a search is made in the Newton direction and then in the Gradient direction if there is no success in the Newton direction. This algorithm can also be used for functions minimization. Knowledge of all the partial derivatives (the Jacobian) is required.

    Constructor & Destructor Documentation

    ◆ math_FunctionSetRoot() [1/2]

    math_FunctionSetRoot::math_FunctionSetRoot ( math_FunctionSetWithDerivatives & F,
    const math_Vector & Tolerance,
    const int NbIterations = 100 )

    is used in a sub-class to initialize correctly all the fields of this class. The range (1, F.NbVariables()) must be especially respected for all vectors and matrix declarations.

    ◆ math_FunctionSetRoot() [2/2]

    math_FunctionSetRoot::math_FunctionSetRoot ( math_FunctionSetWithDerivatives & F,
    const int NbIterations = 100 )

    is used in a sub-class to initialize correctly all the fields of this class. The range (1, F.NbVariables()) must be especially respected for all vectors and matrix declarations. The method SetTolerance must be called after this constructor.

    ◆ ~math_FunctionSetRoot()

    virtual math_FunctionSetRoot::~math_FunctionSetRoot ( )
    virtual

    Destructor.

    Member Function Documentation

    ◆ Derivative() [1/2]

    const math_Matrix & math_FunctionSetRoot::Derivative ( ) const
    inline

    Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.

    ◆ Derivative() [2/2]

    void math_FunctionSetRoot::Derivative ( math_Matrix & Der) const
    inline

    outputs the matrix value of the derivative at the root in Der. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the column range of <Der> is not equal to the range of the startingPoint.

    ◆ Dump()

    void math_FunctionSetRoot::Dump ( Standard_OStream & o) const

    Prints on the stream o information on the current state of the object. Is used to redefine the operator <<.

    ◆ FunctionSetErrors() [1/2]

    const math_Vector & math_FunctionSetRoot::FunctionSetErrors ( ) const
    inline

    returns the vector value of the error done on the functions at the root. Exception NotDone is raised if the root was not found.

    ◆ FunctionSetErrors() [2/2]

    void math_FunctionSetRoot::FunctionSetErrors ( math_Vector & Err) const

    outputs the vector value of the error done on the functions at the root in Err. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the range of Err is not equal to the range of the StartingPoint.

    ◆ IsDivergent()

    bool math_FunctionSetRoot::IsDivergent ( ) const
    inline

    ◆ IsDone()

    bool math_FunctionSetRoot::IsDone ( ) const
    inline

    Returns true if the computations are successful, otherwise returns false.

    ◆ IsSolutionReached()

    virtual bool math_FunctionSetRoot::IsSolutionReached ( math_FunctionSetWithDerivatives & )
    inlinevirtual

    This routine is called at the end of each iteration to check if the solution was found. It can be redefined in a sub-class to implement a specific test to stop the iterations. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.

    ◆ NbIterations()

    int math_FunctionSetRoot::NbIterations ( ) const
    inline

    Returns the number of iterations really done during the computation of the root. Exception NotDone is raised if the root was not found.

    ◆ Perform() [1/2]

    void math_FunctionSetRoot::Perform ( math_FunctionSetWithDerivatives & theFunction,
    const math_Vector & theStartingPoint,
    const bool theStopOnDivergent = false )

    Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1)(j) <= Tolerance(j) for all unknowns.

    ◆ Perform() [2/2]

    void math_FunctionSetRoot::Perform ( math_FunctionSetWithDerivatives & theFunction,
    const math_Vector & theStartingPoint,
    const math_Vector & theInfBound,
    const math_Vector & theSupBound,
    const bool theStopOnDivergent = false )

    Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.

    ◆ Root() [1/2]

    const math_Vector & math_FunctionSetRoot::Root ( ) const
    inline

    Returns the value of the root of function F. Exception NotDone is raised if the root was not found.

    ◆ Root() [2/2]

    void math_FunctionSetRoot::Root ( math_Vector & Root) const

    Outputs the root vector in Root. Exception NotDone is raised if the root was not found. Exception DimensionError is raised if the range of Root is not equal to the range of the StartingPoint.

    ◆ SetTolerance()

    void math_FunctionSetRoot::SetTolerance ( const math_Vector & Tolerance)

    Initializes the tolerance values.

    ◆ StateNumber()

    int math_FunctionSetRoot::StateNumber ( ) const
    inline

    returns the stateNumber (as returned by F.GetStateNumber()) associated to the root found.

    Field Documentation

    ◆ Delta

    math_Vector math_FunctionSetRoot::Delta
    protected

    ◆ DF

    math_Matrix math_FunctionSetRoot::DF
    protected

    ◆ Sol

    math_Vector math_FunctionSetRoot::Sol
    protected

    ◆ Tol

    math_Vector math_FunctionSetRoot::Tol
    protected

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