OCC.math module

class SwigPyIterator(*args, **kwargs)

Bases: object

advance()
copy()
decr()
distance()
equal()
incr()
next()
previous()
thisown

The membership flag

value()
class math

Bases: object

static GaussPoints(*args)
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
Return type:

void

static GaussPointsMax(*args)
Return type:int
static GaussWeights(*args)
Parameters:
  • Index (int) –
  • Weights (math_Vector &) –
Return type:

void

static KronrodPointsAndWeights(*args)
  • Returns a vector of Kronrod points and a vector of their weights for Gauss-Kronrod computation method. Index should be odd and greater then or equal to 3, as the number of Kronrod points is equal to 2*N + 1, where N is a number of Gauss points. Points and Weights should have the size equal to Index. Each even element of Points represents a Gauss point value of N-th Gauss quadrature. The values from Index equal to 3 to 123 are stored in a table (see the file math_Kronrod.cxx). If Index is greater, then points and weights will be computed. Returns Standard_True if Index is odd, it is equal to the size of Points and Weights and the computation of Points and Weights is performed successfully. Otherwise this method returns Standard_False.
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
  • Weights (math_Vector &) –
Return type:

bool

static KronrodPointsMax(*args)
  • Returns the maximal number of points for that the values are stored in the table. If the number is greater then KronrodPointsMax, the points will be computed.
Return type:int
static OrderedGaussPointsAndWeights(*args)
  • Returns a vector of Gauss points and a vector of their weights. The difference with the method GaussPoints is the following: - the points are returned in increasing order. - if Index is greater then GaussPointsMax, the points are computed. Returns Standard_True if Index is positive, Points’ and Weights’ length is equal to Index, Points and Weights are successfully computed.
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
  • Weights (math_Vector &) –
Return type:

bool

thisown

The membership flag

class math_Array1OfValueAndWeight(*args)

Bases: object

Parameters:
  • Low (int) –
  • Up (int) –
  • Item (math_ValueAndWeight &) –
  • Low
  • Up
Return type:

None

Return type:

None

Assign()
Parameters:Other (math_Array1OfValueAndWeight &) –
Return type:math_Array1OfValueAndWeight
ChangeValue()
Parameters:Index (int) –
Return type:math_ValueAndWeight
Destroy()
Return type:None
Init()
Parameters:V (math_ValueAndWeight &) –
Return type:None
IsAllocated()
Return type:bool
Length()
Return type:int
Lower()
Return type:int
Set()
Parameters:Other (math_Array1OfValueAndWeight &) –
Return type:math_Array1OfValueAndWeight
SetValue()
Parameters:
  • Index (int) –
  • Value (math_ValueAndWeight &) –
Return type:

None

Upper()
Return type:int
Value()
Parameters:Index (int) –
Return type:math_ValueAndWeight
thisown

The membership flag

class math_BFGS(*args)

Bases: object

  • Given the starting point StartingPoint, the Broyden-Fletcher-Goldfarb-Shanno variant of Davidson-Fletcher-Powell minimization is done on the function F. The tolerance required on F is given by Tolerance. The solution F = Fi is found when : 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • StartingPoint (math_Vector &) –
  • Tolerance (float) – default value is 1.0e-8
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

  • Initializes the computation of the minimum of F. Warning A call to the Perform method must be made after this initialization to effectively compute the minimum of the function F.
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • Tolerance (float) – default value is 1.0e-8
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

Delete()
Return type:void
DumpToString()

math_BFGS_DumpToString(math_BFGS self) -> std::string

Gradient()
  • Returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.
Return type:math_Vector
  • Returns the value of the gradient vector at the minimum in Grad. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Grad is not equal to the range of the StartingPoint.
Parameters:Grad (math_Vector &) –
Return type:None
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • This method is called at the end of each iteration to check if the solution is found. It can be redefined in a sub-class to implement a specific test to stop the iterations.
Parameters:F (math_MultipleVarFunctionWithGradient &) –
Return type:bool
Location()
  • returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:math_Vector
  • outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.
Parameters:Loc (math_Vector &) –
Return type:None
Minimum()
  • returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
NbIterations()
  • Returns the number of iterations really done in the calculation of the minimum. The exception NotDone is raised if the minimum was not found.
Return type:int
Perform()
  • Is used internally by the constructors.
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • StartingPoint (math_Vector &) –
Return type:

None

thisown

The membership flag

class math_BissecNewton(*args)

Bases: object

  • A combination of Newton-Raphson and bissection methods is done to find the root of the function F between the bounds Bound1 and Bound2. on the function F. The tolerance required on the root is given by TolX. The solution is found when : abs(Xi - Xi-1) <= TolX and F(Xi) * F(Xi-1) <= 0 The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Bound1 (float) –
  • Bound2 (float) –
  • TolX (float) –
  • NbIterations (int) – default value is 100
Return type:

None

Derivative()
  • returns the value of the derivative at the root. Exception NotDone is raised if the minimum was not found.
Return type:float
DumpToString()

math_BissecNewton_DumpToString(math_BissecNewton self) -> std::string

IsDone()
  • Tests is the root has been successfully found.
Return type:bool
IsSolutionReached()
  • This method is called at the end of each iteration to check if the solution has been found. It can be redefined in a sub-class to implement a specific test to stop the iterations.
Parameters:F (math_FunctionWithDerivative &) –
Return type:bool
Root()
  • returns the value of the root. Exception NotDone is raised if the minimum was not found.
Return type:float
Value()
  • returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.
Return type:float
thisown

The membership flag

class math_BracketMinimum(*args)

Bases: object

  • Given two initial values this class computes a bracketing triplet of abscissae Ax, Bx, Cx (such that Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) the Brent minimization is done on the function F.
Parameters:
  • F (math_Function &) –
  • A (float) –
  • B (float) –
Return type:

None

  • Given two initial values this class computes a bracketing triplet of abscissae Ax, Bx, Cx (such that Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) the Brent minimization is done on the function F. This constructor has to be used if F(A) is known.
Parameters:
Return type:

None

  • Given two initial values this class computes a bracketing triplet of abscissae Ax, Bx, Cx (such that Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) the Brent minimization is done on the function F. This constructor has to be used if F(A) and F(B) are known.
Parameters:
Return type:

None

DumpToString()

math_BracketMinimum_DumpToString(math_BracketMinimum self) -> std::string

FunctionValues()
  • returns the bracketed triplet function values. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Parameters:
  • FA (float &) –
  • FB (float &) –
  • FC (float &) –
Return type:

None

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
Values()
  • Returns the bracketed triplet of abscissae. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Parameters:
  • A (float &) –
  • B (float &) –
  • C (float &) –
Return type:

None

thisown

The membership flag

class math_BracketedRoot(*args)

Bases: object

  • The Brent method is used to find the root of the function F between the bounds Bound1 and Bound2 on the function F. If F(Bound1)*F(Bound2) >0 the Brent method fails. The tolerance required for the root is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= Tolerance; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_Function &) –
  • Bound1 (float) –
  • Bound2 (float) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 100
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

DumpToString()

math_BracketedRoot_DumpToString(math_BracketedRoot self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbIterations()
  • returns the number of iterations really done during the computation of the Root. Exception NotDone is raised if the minimum was not found.
Return type:int
Root()
  • returns the value of the root. Exception NotDone is raised if the minimum was not found.
Return type:float
Value()
  • returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.
Return type:float
thisown

The membership flag

class math_BrentMinimum(*args)

Bases: object

  • This constructor should be used in a sub-class to initialize correctly all the fields of this class.
Parameters:
  • TolX (float) –
  • NbIterations (int) – default value is 100
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

  • This constructor should be used in a sub-class to initialize correctly all the fields of this class. It has to be used if F(Bx) is known.
Parameters:
  • TolX (float) –
  • Fbx (float) –
  • NbIterations (int) – default value is 100
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

  • Given a bracketing triplet of abscissae Ax, Bx, Cx (such as Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) the Brent minimization is done on the function F. The tolerance required on F is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= TolX * abs(Xi) + ZEPS; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_Function &) –
  • Ax (float) –
  • Bx (float) –
  • Cx (float) –
  • TolX (float) –
  • NbIterations (int) – default value is 100
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

DumpToString()

math_BrentMinimum_DumpToString(math_BrentMinimum self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • This method is called at the end of each iteration to check if the solution is found. It can be redefined in a sub-class to implement a specific test to stop the iterations.
Parameters:F (math_Function &) –
Return type:bool
Location()
  • returns the location value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
Minimum()
  • returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
NbIterations()
  • returns the number of iterations really done during the computation of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:int
Perform()
  • Brent minimization is performed on function F from a given bracketing triplet of abscissas Ax, Bx, Cx (such that Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) Warning The initialization constructors must have been called before the call to the Perform method.
Parameters:
Return type:

None

thisown

The membership flag

class math_BullardGenerator(*args)

Bases: object

  • Creates new Xorshift 64-bit RNG.
Parameters:theSeed (unsigned int) – default value is 1
Return type:None
NextInt()
  • Generates new 64-bit integer value.
Return type:unsigned int
NextReal()
  • Generates new floating-point value.
Return type:float
thisown

The membership flag

class math_CompareOfValueAndWeight(*args)

Bases: object

Return type:None
IsEqual()
  • returns True when <Right> and <Left> are equal.
Parameters:
  • Left (math_ValueAndWeight &) –
  • Right (math_ValueAndWeight &) –
Return type:

bool

IsGreater()
  • Returns True if <Left.Value()> is greater than <Right.Value()>.
Parameters:
  • Left (math_ValueAndWeight &) –
  • Right (math_ValueAndWeight &) –
Return type:

bool

IsLower()
  • Returns True if <Left.Value()> is lower than <Right.Value()>.
Parameters:
  • Left (math_ValueAndWeight &) –
  • Right (math_ValueAndWeight &) –
Return type:

bool

thisown

The membership flag

class math_ComputeGaussPointsAndWeights(*args)

Bases: object

Parameters:Number (int) –
Return type:None
IsDone()
Return type:bool
Points()
Return type:math_Vector
Weights()
Return type:math_Vector
thisown

The membership flag

class math_ComputeKronrodPointsAndWeights(*args)

Bases: object

Parameters:Number (int) –
Return type:None
IsDone()
Return type:bool
Points()
Return type:math_Vector
Weights()
Return type:math_Vector
thisown

The membership flag

class math_Crout(*args)

Bases: object

  • Given an input matrix A, this algorithm inverts A by the Crout algorithm. The user can give only the inferior triangle for the implementation. A can be decomposed like this: A = L * D * T(L) where L is triangular inferior and D is diagonal. If one element of A is less than MinPivot, A is considered as singular. Exception NotSquare is raised if A is not a square matrix.
Parameters:
  • A (math_Matrix &) –
  • MinPivot (float) – default value is 1.0e-20
Return type:

None

Determinant()
  • Returns the value of the determinant of the previously LU decomposed matrix A. Zero is returned if the matrix A is considered as singular. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Return type:float
DumpToString()

math_Crout_DumpToString(math_Crout self) -> std::string

Inverse()
  • returns the inverse matrix of A. Only the inferior triangle is returned. Exception NotDone is raised if NotDone.
Return type:math_Matrix
Invert()
  • returns in Inv the inverse matrix of A. Only the inferior triangle is returned. Exception NotDone is raised if NotDone.
Parameters:Inv (math_Matrix &) –
Return type:None
IsDone()
  • Returns True if all has been correctly done.
Return type:bool
Solve()
  • Given an input vector <B>, this routine returns the solution of the set of linear equations A . X = B. Exception NotDone is raised if the decomposition was not done successfully. Exception DimensionError is raised if the range of B is not equal to the rowrange of A.
Parameters:
  • B (math_Vector &) –
  • X (math_Vector &) –
Return type:

None

thisown

The membership flag

class math_DirectPolynomialRoots(*args)

Bases: object

  • computes all the real roots of the polynomial Ax4 + Bx3 + Cx2 + Dx + E using a direct method.
Parameters:
Return type:

None

  • computes all the real roots of the polynomial Ax3 + Bx2 + Cx + D using a direct method.
Parameters:
Return type:

None

  • computes all the real roots of the polynomial Ax2 + Bx + C using a direct method.
Parameters:
Return type:

None

  • computes the real root of the polynomial Ax + B.
Parameters:
Return type:

None

DumpToString()

math_DirectPolynomialRoots_DumpToString(math_DirectPolynomialRoots self) -> std::string

InfiniteRoots()
  • Returns true if there is an infinity of roots, otherwise returns false.
Return type:bool
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbSolutions()
  • returns the number of solutions. An exception is raised if there are an infinity of roots.
Return type:int
Value()
  • returns the value of the Nieme root. An exception is raised if there are an infinity of roots. Exception RangeError is raised if Nieme is < 1 or Nieme > NbSolutions.
Parameters:Nieme (int) –
Return type:float
thisown

The membership flag

class math_DoubleTab(*args)

Bases: object

Parameters:
  • LowerRow (int) –
  • UpperRow (int) –
  • LowerCol (int) –
  • UpperCol (int) –
  • Tab (Standard_Address) –
  • LowerRow
  • UpperRow
  • LowerCol
  • UpperCol
  • Other (math_DoubleTab &) –
Return type:

None

Return type:

None

Return type:

None

Copy()
Parameters:Other (math_DoubleTab &) –
Return type:None
Free()
Return type:None
Init()
Parameters:InitValue (float) –
Return type:None
SetLowerCol()
Parameters:LowerCol (int) –
Return type:None
SetLowerRow()
Parameters:LowerRow (int) –
Return type:None
Value()
Parameters:
  • RowIndex (int) –
  • ColIndex (int) –
Return type:

float

thisown

The membership flag

class math_EigenValuesSearcher(*args)

Bases: object

Parameters:
  • Diagonal (TColStd_Array1OfReal &) –
  • Subdiagonal (TColStd_Array1OfReal &) –
Return type:

None

Dimension()
  • Returns the dimension of matrix
Return type:int
EigenValue()
  • Returns the Index_th eigen value of matrix Index must be in [1, Dimension()]
Parameters:Index (int) –
Return type:float
EigenVector()
  • Returns the Index_th eigen vector of matrix Index must be in [1, Dimension()]
Parameters:Index (int) –
Return type:math_Vector
IsDone()
  • Returns Standard_True if computation is performed successfully.
Return type:bool
thisown

The membership flag

class math_FRPR(*args)

Bases: object

  • Computes FRPR minimization function F from input vector StartingPoint. The solution F = Fi is found when 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • StartingPoint (math_Vector &) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

  • Purpose Initializes the computation of the minimum of F. Warning A call to the Perform method must be made after this initialization to compute the minimum of the function.
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

Delete()
Return type:void
DumpToString()

math_FRPR_DumpToString(math_FRPR self) -> std::string

Gradient()
  • returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.
Return type:math_Vector
  • outputs the gradient vector at the minimum in Grad. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Grad is not equal to the range of the StartingPoint.
Parameters:Grad (math_Vector &) –
Return type:None
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • The solution F = Fi is found when : 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS. The maximum number of iterations allowed is given by NbIterations.
Parameters:F (math_MultipleVarFunctionWithGradient &) –
Return type:bool
Location()
  • returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:math_Vector
  • outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.
Parameters:Loc (math_Vector &) –
Return type:None
Minimum()
  • returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
NbIterations()
  • returns the number of iterations really done during the computation of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:int
Perform()
  • Use this method after a call to the initialization constructor to compute the minimum of function F. Warning The initialization constructor must have been called before the Perform method is called
Parameters:
  • F (math_MultipleVarFunctionWithGradient &) –
  • StartingPoint (math_Vector &) –
Return type:

None

thisown

The membership flag

class math_Function(*args, **kwargs)

Bases: object

GetStateNumber()
  • returns the state of the function corresponding to the latest call of any methods associated with the function. This function is called by each of the algorithms described later which defined the function Integer Algorithm::StateNumber(). The algorithm has the responsibility to call this function when it has found a solution (i.e. a root or a minimum) and has to maintain the association between the solution found and this StateNumber. Byu default, this method returns 0 (which means for the algorithm: no state has been saved). It is the responsibility of the programmer to decide if he needs to save the current state of the function and to return an Integer that allows retrieval of the state.
Return type:int
Value()
  • Computes the value of the function <F> for a given value of variable <X>. returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (float) –
  • F (float &) –
Return type:

bool

thisown

The membership flag

class math_FunctionAllRoots(*args)

Bases: object

  • The algorithm uses the sample to find intervals on which the function is null. An interval is found if, for at least two consecutive points of the sample, Ui and Ui+1, we get |F(Ui)|<=EpsNul and |F(Ui+1)|<=EpsNul. The real bounds of an interval are computed with the FunctionRoots. algorithm. Between two intervals, the roots of the function F are calculated using the FunctionRoots algorithm.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • S (math_FunctionSample &) –
  • EpsX (float) –
  • EpsF (float) –
  • EpsNul (float) –
Return type:

None

DumpToString()

math_FunctionAllRoots_DumpToString(math_FunctionAllRoots self) -> std::string

GetInterval()
  • Returns the interval of parameter of range Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.
Parameters:
  • Index (int) –
  • A (float &) –
  • B (float &) –
Return type:

None

GetIntervalState()
  • returns the State Number associated to the interval Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.
Parameters:
  • Index (int) –
  • IFirst (int &) –
  • ILast (int &) –
Return type:

None

GetPoint()
  • Returns the parameter of the point of range Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >NbPoints.
Parameters:Index (int) –
Return type:float
GetPointState()
  • returns the State Number associated to the point Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.
Parameters:Index (int) –
Return type:int
IsDone()
  • Returns True if the computation has been done successfully.
Return type:bool
NbIntervals()
  • Returns the number of intervals on which the function is Null. An exception is raised if IsDone returns False.
Return type:int
NbPoints()
  • returns the number of points where the function is Null. An exception is raised if IsDone returns False.
Return type:int
thisown

The membership flag

class math_FunctionRoot(*args)

Bases: object

  • The Newton-Raphson method is done to find the root of the function F from the initial guess Guess.The tolerance required on the root is given by Tolerance. Iterations are stopped if the expected solution does not stay in the range A..B. The solution is found when abs(Xi - Xi-1) <= Tolerance; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Guess (float) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • The Newton-Raphson method is done to find the root of the function F from the initial guess Guess. The tolerance required on the root is given by Tolerance. Iterations are stopped if the expected solution does not stay in the range A..B The solution is found when abs(Xi - Xi-1) <= Tolerance; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Guess (float) –
  • Tolerance (float) –
  • A (float) –
  • B (float) –
  • NbIterations (int) – default value is 100
Return type:

None

Derivative()
  • returns the value of the derivative at the root. Exception NotDone is raised if the root was not found.
Return type:float
DumpToString()

math_FunctionRoot_DumpToString(math_FunctionRoot self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbIterations()
  • returns the number of iterations really done on the computation of the Root. Exception NotDone is raised if the root was not found.
Return type:int
Root()
  • returns the value of the root. Exception NotDone is raised if the root was not found.
Return type:float
Value()
  • returns the value of the function at the root. Exception NotDone is raised if the root was not found.
Return type:float
thisown

The membership flag

class math_FunctionRoots(*args)

Bases: object

  • Calculates all the real roots of a function F-K within the range A..B. whithout conditions on A and B A solution X is found when abs(Xi - Xi-1) <= Epsx and abs(F(Xi)-K) <= EpsF. The function is considered as null between A and B if abs(F-K) <= EpsNull within this range.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • A (float) –
  • B (float) –
  • NbSample (int) –
  • EpsX (float) – default value is 0.0
  • EpsF (float) – default value is 0.0
  • EpsNull (float) – default value is 0.0
  • K (float) – default value is 0.0
Return type:

None

DumpToString()

math_FunctionRoots_DumpToString(math_FunctionRoots self) -> std::string

IsAllNull()
  • returns true if the function is considered as null between A and B. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Return type:bool
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbSolutions()
  • Returns the number of solutions found. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Return type:int
StateNumber()
  • returns the StateNumber of the Nieme root. Exception RangeError is raised if Nieme is < 1 or Nieme > NbSolutions.
Parameters:Nieme (int) –
Return type:int
Value()
  • Returns the Nth value of the root of function F. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Parameters:Nieme (int) –
Return type:float
thisown

The membership flag

class math_FunctionSample(*args)

Bases: object

Parameters:
Return type:

None

Bounds()
  • Returns the bounds of parameters.
Parameters:
  • A (float &) –
  • B (float &) –
Return type:

void

GetParameter()
  • Returns the value of parameter of the point of range Index : A + ((Index-1)/(NbPoints-1))*B. An exception is raised if Index<=0 or Index>NbPoints.
Parameters:Index (int) –
Return type:float
NbPoints()
  • Returns the number of sample points.
Return type:int
thisown

The membership flag

class math_FunctionSet(*args, **kwargs)

Bases: object

Delete()
Return type:void
GetStateNumber()
  • Returns the state of the function corresponding to the latestcall of any methods associated with the function. This function is called by each of the algorithms described later which define the function Integer Algorithm::StateNumber(). The algorithm has the responsibility to call this function when it has found a solution (i.e. a root or a minimum) and has to maintain the association between the solution found and this StateNumber. Byu default, this method returns 0 (which means for the algorithm: no state has been saved). It is the responsibility of the programmer to decide if he needs to save the current state of the function and to return an Integer that allows retrieval of the state.
Return type:int
NbEquations()
  • Returns the number of equations of the function.
Return type:int
NbVariables()
  • Returns the number of variables of the function.
Return type:int
Value()
  • Computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • F (math_Vector &) –
Return type:

bool

thisown

The membership flag

class math_FunctionSetRoot(*args)

Bases: object

  • 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.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • Tolerance (math_Vector &) –
  • NbIterations (int) – default value is 100
Return type:

None

  • 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.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • NbIterations (int) – default value is 100
Return type:

None

  • is used to improve the root of the function F from the initial guess StartingPoint. The maximum number of iterations allowed is given by NbIterations. In this case, the solution is found when: abs(Xi - Xi-1)(j) <= Tolerance(j) for all unknowns.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • Tolerance (math_Vector &) –
  • NbIterations (int) – default value is 100
Return type:

None

  • is used to improve the root of the function F from the initial guess StartingPoint. The maximum number of iterations allowed is given by NbIterations. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • Tolerance (math_Vector &) –
  • infBound (math_Vector &) –
  • supBound (math_Vector &) –
  • NbIterations (int) – default value is 100
  • theStopOnDivergent (bool) – default value is Standard_False
Return type:

None

Delete()
Return type:void
Derivative()
  • Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.
Return type:math_Matrix
  • 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.
Parameters:Der (math_Matrix &) –
Return type:None
DumpToString()

math_FunctionSetRoot_DumpToString(math_FunctionSetRoot self) -> std::string

FunctionSetErrors()
  • returns the vector value of the error done on the functions at the root. Exception NotDone is raised if the root was not found.
Return type:math_Vector
  • 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.
Parameters:Err (math_Vector &) –
Return type:None
IsDivergent()
Return type:bool
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • 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.
Parameters:F (math_FunctionSetWithDerivatives &) –
Return type:bool
NbIterations()
  • Returns the number of iterations really done during the computation of the root. Exception NotDone is raised if the root was not found.
Return type:int
Perform()
  • Improves the root of function F from the initial guess StartingPoint. infBound and supBound may be given to constrain the solution. Warning This method is called when computation of the solution is not performed by the constructors.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • infBound (math_Vector &) –
  • supBound (math_Vector &) –
  • theStopOnDivergent (bool) – default value is Standard_False
Return type:

None

Root()
  • Returns the value of the root of function F. Exception NotDone is raised if the root was not found.
Return type:math_Vector
  • 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.
Parameters:Root (math_Vector &) –
Return type:None
SetTolerance()
  • Initializes the tolerance values.
Parameters:Tolerance (math_Vector &) –
Return type:None
StateNumber()
  • returns the stateNumber (as returned by F.GetStateNumber()) associated to the root found.
Return type:int
thisown

The membership flag

class math_FunctionSetWithDerivatives(*args, **kwargs)

Bases: OCC.math.math_FunctionSet

Derivatives()
  • Returns the values <D> of the derivatives for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • D (math_Matrix &) –
Return type:

bool

Values()
  • returns the values <F> of the functions and the derivatives <D> for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • F (math_Vector &) –
  • D (math_Matrix &) –
Return type:

bool

thisown

The membership flag

class math_FunctionWithDerivative(*args, **kwargs)

Bases: OCC.math.math_Function

Delete()
Return type:void
Derivative()
  • Computes the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.
Parameters:
  • X (float) –
  • D (float &) –
Return type:

bool

Values()
  • Computes the value <F> and the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.
Parameters:
  • X (float) –
  • F (float &) –
  • D (float &) –
Return type:

bool

thisown

The membership flag

class math_Gauss(*args)

Bases: object

  • Given an input n X n matrix A this constructor performs its LU decomposition with partial pivoting (interchange of rows). This LU decomposition is stored internally and may be used to do subsequent calculation. If the largest pivot found is less than MinPivot the matrix A is considered as singular. Exception NotSquare is raised if A is not a square matrix.
Parameters:
  • A (math_Matrix &) –
  • MinPivot (float) – default value is 1.0e-20
Return type:

None

Determinant()
  • This routine returns the value of the determinant of the previously LU decomposed matrix A. Exception NotDone may be raised if the decomposition of A was not done successfully, zero is returned if the matrix A was considered as singular.
Return type:float
DumpToString()

math_Gauss_DumpToString(math_Gauss self) -> std::string

Invert()
  • This routine outputs Inv the inverse of the previously LU decomposed matrix A. Exception DimensionError is raised if the ranges of B are not equal to the ranges of A.
Parameters:Inv (math_Matrix &) –
Return type:None
IsDone()
  • Returns true if the computations are successful, otherwise returns false
Return type:bool
Solve()
  • Given the input Vector B this routine returns the solution X of the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the number of rows of A.
Parameters:
  • B (math_Vector &) –
  • X (math_Vector &) –
Return type:

None

  • Given the input Vector B this routine solves the set of linear equations A . X = B. B is replaced by the vector solution X. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the number of rows of A.
Parameters:B (math_Vector &) –
Return type:None
thisown

The membership flag

class math_GaussLeastSquare(*args)

Bases: object

  • Given an input n X m matrix A with n >= m this constructor performs the LU decomposition with partial pivoting (interchange of rows) of the matrix AA = A.Transposed() * A; This LU decomposition is stored internally and may be used to do subsequent calculation. If the largest pivot found is less than MinPivot the matrix <A> is considered as singular.
Parameters:
  • A (math_Matrix &) –
  • MinPivot (float) – default value is 1.0e-20
Return type:

None

DumpToString()

math_GaussLeastSquare_DumpToString(math_GaussLeastSquare self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.e
Return type:bool
Solve()
  • Given the input Vector <B> this routine solves the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B Inv is not equal to the rowrange of A. Exception DimensionError is raised if the range of X Inv is not equal to the colrange of A.
Parameters:
  • B (math_Vector &) –
  • X (math_Vector &) –
Return type:

None

thisown

The membership flag

class math_GaussMultipleIntegration(*args)

Bases: object

  • The Gauss-Legendre integration with Order = points of integration for each unknow, is done on the function F between the bounds Lower and Upper.
Parameters:
  • F (math_MultipleVarFunction &) –
  • Lower (math_Vector &) –
  • Upper (math_Vector &) –
  • Order (math_IntegerVector &) –
Return type:

None

DumpToString()

math_GaussMultipleIntegration_DumpToString(math_GaussMultipleIntegration self) -> std::string

IsDone()
  • returns True if all has been correctly done.
Return type:bool
Value()
  • returns the value of the integral.
Return type:float
thisown

The membership flag

math_GaussPoints(*args)
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
Return type:

void

math_GaussPointsMax(*args)
Return type:int
class math_GaussSetIntegration(*args)

Bases: object

  • The Gauss-Legendre integration with Order = points of integration for each unknow, is done on the function F between the bounds Lower and Upper.
Parameters:
  • F (math_FunctionSet &) –
  • Lower (math_Vector &) –
  • Upper (math_Vector &) –
  • Order (math_IntegerVector &) –
Return type:

None

DumpToString()

math_GaussSetIntegration_DumpToString(math_GaussSetIntegration self) -> std::string

IsDone()
  • returns True if all has been correctly done.
Return type:bool
Value()
  • returns the value of the integral.
Return type:math_Vector
thisown

The membership flag

class math_GaussSingleIntegration(*args)

Bases: object

Return type:None
  • The Gauss-Legendre integration with N = Order points of integration, is done on the function F between the bounds Lower and Upper.
Parameters:
  • F (math_Function &) –
  • Lower (float) –
  • Upper (float) –
  • Order (int) –
Return type:

None

  • The Gauss-Legendre integration with N = Order points of integration and given tolerance = Tol is done on the function F between the bounds Lower and Upper.
Parameters:
  • F (math_Function &) –
  • Lower (float) –
  • Upper (float) –
  • Order (int) –
  • Tol (float) –
Return type:

None

DumpToString()

math_GaussSingleIntegration_DumpToString(math_GaussSingleIntegration self) -> std::string

IsDone()
  • returns True if all has been correctly done.
Return type:bool
Value()
  • returns the value of the integral.
Return type:float
thisown

The membership flag

math_GaussWeights(*args)
Parameters:
  • Index (int) –
  • Weights (math_Vector &) –
Return type:

void

class math_GlobOptMin(*args)

Bases: object

Parameters:
  • theFunc (math_MultipleVarFunction *) –
  • theA (math_Vector &) –
  • theB (math_Vector &) –
  • theC (float) – default value is 9
  • theDiscretizationTol (float) – default value is 1.0e-2
  • theSameTol (float) – default value is 1.0e-7
Return type:

None

GetF()
  • Get best functional value.
Return type:float
GetTol()
Parameters:
  • theDiscretizationTol (float &) –
  • theSameTol (float &) –
Return type:

None

NbExtrema()
  • Return count of global extremas.
Return type:int
Perform()
Return type:None
Points()
  • Return solution i, 1 <= i <= NbExtrema.
Parameters:
  • theIndex (int) –
  • theSol (math_Vector &) –
Return type:

None

SetGlobalParams()
Parameters:
  • theFunc (math_MultipleVarFunction *) –
  • theA (math_Vector &) –
  • theB (math_Vector &) –
  • theC (float) – default value is 9
  • theDiscretizationTol (float) – default value is 1.0e-2
  • theSameTol (float) – default value is 1.0e-7
Return type:

None

SetLocalParams()
Parameters:
  • theLocalA (math_Vector &) –
  • theLocalB (math_Vector &) –
Return type:

None

SetTol()
Parameters:
  • theDiscretizationTol (float) –
  • theSameTol (float) –
Return type:

None

thisown

The membership flag

class math_Householder(*args)

Bases: object

  • Given an input matrix A with n>= m, given an input matrix B this constructor performs the least square resolution of the set of linear equations A.X = B for each column of B. If a column norm is less than EPS, the resolution can’t be done. Exception DimensionError is raised if the row number of B is different from the A row number.
Parameters:
  • A (math_Matrix &) –
  • B (math_Matrix &) –
  • EPS (float) – default value is 1.0e-20
Return type:

None

  • Given an input matrix A with n>= m, given an input matrix B this constructor performs the least square resolution of the set of linear equations A.X = B for each column of B. If a column norm is less than EPS, the resolution can’t be done. Exception DimensionError is raised if the row number of B is different from the A row number.
Parameters:
  • A (math_Matrix &) –
  • B (math_Matrix &) –
  • lowerArow (int) –
  • upperArow (int) –
  • lowerAcol (int) –
  • upperAcol (int) –
  • EPS (float) – default value is 1.0e-20
Return type:

None

  • Given an input matrix A with n>= m, given an input vector B this constructor performs the least square resolution of the set of linear equations A.X = B. If a column norm is less than EPS, the resolution can’t be done. Exception DimensionError is raised if the length of B is different from the A row number.
Parameters:
  • A (math_Matrix &) –
  • B (math_Vector &) –
  • EPS (float) – default value is 1.0e-20
Return type:

None

AllValues()
  • Returns the matrix sol of all the solutions of the system A.X = B. Exception NotDone is raised is the resolution has not be done.
Return type:math_Matrix
DumpToString()

math_Householder_DumpToString(math_Householder self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
Value()
  • Given the integer Index, this routine returns the corresponding least square solution sol. Exception NotDone is raised if the resolution has not be done. Exception OutOfRange is raised if Index <=0 or Index is more than the number of columns of B.
Parameters:
  • sol (math_Vector &) –
  • Index (int) – default value is 1
Return type:

None

thisown

The membership flag

class math_IntegerRandom(*args)

Bases: object

  • creates a Integer random generator between the values Lower and Upper.
Parameters:
  • Lower (int) –
  • Upper (int) –
Return type:

None

Next()
  • returns the next random number.
Return type:int
Reset()
  • reinitializes the random generator
Return type:None
thisown

The membership flag

class math_IntegerVector(*args)

Bases: object

  • contructs an IntegerVector in the range [Lower..Upper]
Parameters:
  • theFirst (int) –
  • theLast (int) –
Return type:

None

  • contructs an IntegerVector in the range [Lower..Upper] with all the elements set to theInitialValue.
Parameters:
  • theFirst (int) –
  • theLast (int) –
  • theInitialValue (int) –
Return type:

None

  • constructs an IntegerVector in the range [Lower..Upper] which share the ‘c array’ theTab.
Parameters:
  • theTab (Standard_Address) –
  • theFirst (int) –
  • theLast (int) –
Return type:

None

  • constructs a copy for initialization. An exception is raised if the lengths of the IntegerVectors are different.
Parameters:theOther (math_IntegerVector &) –
Return type:None
Add()
  • adds the IntegerVector ‘theRight’ to an IntegerVector. An exception is raised if the IntegerVectors have not the same length. An exception is raised if the lengths are not equal.
Parameters:theRight (math_IntegerVector &) –
Return type:None
  • sets an IntegerVector to the sum of the IntegerVector ‘theLeft’ and the IntegerVector ‘theRight’. An exception is raised if the lengths are different.
Parameters:
  • theLeft (math_IntegerVector &) –
  • theRight (math_IntegerVector &) –
Return type:

None

Added()
  • adds the IntegerVector ‘theRight’ to an IntegerVector. An exception is raised if the IntegerVectors have not the same length. An exception is raised if the lengths are not equal.
Parameters:theRight (math_IntegerVector &) –
Return type:math_IntegerVector
DumpToString()

math_IntegerVector_DumpToString(math_IntegerVector self) -> std::string

Init()
  • Initialize an IntegerVector with all the elements set to theInitialValue.
Parameters:theInitialValue (int) –
Return type:None
Initialized()
  • Initialises an IntegerVector by copying ‘theOther’. An exception is raised if the Lengths are different.
Parameters:theOther (math_IntegerVector &) –
Return type:math_IntegerVector
Inverse()
  • returns the inverse IntegerVector of an IntegerVector.
Return type:math_IntegerVector
Invert()
  • inverses an IntegerVector.
Return type:None
Length()
  • returns the length of an IntegerVector
Return type:inline int
Lower()
  • returns the value of the Lower index of an IntegerVector.
Return type:inline int
Max()
  • returns the value of the Index of the maximum element of an IntegerVector.
Return type:int
Min()
  • returns the value of the Index of the minimum element of an IntegerVector.
Return type:int
Multiplied()
  • returns the product of an IntegerVector by an integer value.
Parameters:theRight (int) –
Return type:math_IntegerVector
  • returns the inner product of 2 IntegerVectors. An exception is raised if the lengths are not equal.
Parameters:theRight (math_IntegerVector &) –
Return type:int
Multiply()
  • returns the product of an IntegerVector by an integer value.
Parameters:theRight (int) –
Return type:None
  • returns the multiplication of an integer by an IntegerVector.
Parameters:
  • theLeft (int) –
  • theRight (math_IntegerVector &) –
Return type:

None

Norm()
  • returns the value of the norm of an IntegerVector.
Return type:float
Norm2()
  • returns the value of the square of the norm of an IntegerVector.
Return type:float
Opposite()
  • returns the opposite of an IntegerVector.
Return type:math_IntegerVector
Set()
  • sets an IntegerVector from ‘theI1’ to ‘theI2’ to the IntegerVector ‘theV’; An exception is raised if ‘theI1’ is less than ‘LowerIndex’ or ‘theI2’ is greater than ‘UpperIndex’ or ‘theI1’ is greater than ‘theI2’. An exception is raised if ‘theI2-theI1+1’ is different from the Length of ‘theV’.
Parameters:
  • theI1 (int) –
  • theI2 (int) –
  • theV (math_IntegerVector &) –
  • theOther (math_IntegerVector &) –
Return type:

None

Return type:

math_IntegerVector

Slice()
  • slices the values of the IntegerVector between ‘theI1’ and ‘theI2’: Example: [2, 1, 2, 3, 4, 5] becomes [2, 4, 3, 2, 1, 5] between 2 and 5. An exception is raised if ‘theI1’ is less than ‘LowerIndex’ or ‘theI2’ is greater than ‘UpperIndex’.
Parameters:
  • theI1 (int) –
  • theI2 (int) –
Return type:

math_IntegerVector

Subtract()
  • sets an IntegerVector to the substraction of ‘theRight’ from ‘theLeft’. An exception is raised if the IntegerVectors have not the same length.
Parameters:
  • theLeft (math_IntegerVector &) –
  • theRight (math_IntegerVector &) –
Return type:

None

  • returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the IntegerVectors have not the same length.
Parameters:theRight (math_IntegerVector &) –
Return type:None
Subtracted()
  • returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the IntegerVectors have not the same length.
Parameters:theRight (math_IntegerVector &) –
Return type:math_IntegerVector
TMultiplied()
  • returns the product of a vector and a real value.
Parameters:theRight (int) –
Return type:math_IntegerVector
Upper()
  • returns the value of the Upper index of an IntegerVector.
Return type:inline int
Value()
  • accesses (in read or write mode) the value of index theNum of an IntegerVector.
Parameters:theNum (int) –
Return type:inline int
thisown

The membership flag

class math_Jacobi(*args)

Bases: object

  • Given a Real n X n matrix A, this constructor computes all its eigenvalues and eigenvectors using the Jacobi method. The exception NotSquare is raised if the matrix is not square. No verification that the matrix A is really symmetric is done.
Parameters:A (math_Matrix &) –
Return type:None
DumpToString()

math_Jacobi_DumpToString(math_Jacobi self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
Value()
  • returns the eigenvalue number Num. Eigenvalues are in the range (1..n). Exception NotDone is raised if calculation is not done successfully.
Parameters:Num (int) –
Return type:float
Values()
  • Returns the eigenvalues vector. Exception NotDone is raised if calculation is not done successfully.
Return type:math_Vector
Vector()
  • Returns the eigenvector V of number Num. Eigenvectors are in the range (1..n). Exception NotDone is raised if calculation is not done successfully.
Parameters:
  • Num (int) –
  • V (math_Vector &) –
Return type:

None

Vectors()
  • returns the eigenvectors matrix. Exception NotDone is raised if calculation is not done successfully.
Return type:math_Matrix
thisown

The membership flag

math_KronrodPointsAndWeights(*args)
  • Returns a vector of Kronrod points and a vector of their weights for Gauss-Kronrod computation method. Index should be odd and greater then or equal to 3, as the number of Kronrod points is equal to 2*N + 1, where N is a number of Gauss points. Points and Weights should have the size equal to Index. Each even element of Points represents a Gauss point value of N-th Gauss quadrature. The values from Index equal to 3 to 123 are stored in a table (see the file math_Kronrod.cxx). If Index is greater, then points and weights will be computed. Returns Standard_True if Index is odd, it is equal to the size of Points and Weights and the computation of Points and Weights is performed successfully. Otherwise this method returns Standard_False.
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
  • Weights (math_Vector &) –
Return type:

bool

math_KronrodPointsMax(*args)
  • Returns the maximal number of points for that the values are stored in the table. If the number is greater then KronrodPointsMax, the points will be computed.
Return type:int
class math_KronrodSingleIntegration(*args)

Bases: object

  • An empty constructor.
Return type:None
  • Constructor. Takes the function, the lower and upper bound values, the initial number of Kronrod points
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theNbPnts (int) –
Return type:

None

  • Constructor. Takes the function, the lower and upper bound values, the initial number of Kronrod points, the tolerance value and the maximal number of iterations as parameters.
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theNbPnts (int) –
  • theTolerance (float) –
  • theMaxNbIter (int) –
Return type:

None

AbsolutError()
  • Returns the value of the relative error reached.
Return type:float
ErrorReached()
  • Returns the value of the relative error reached.
Return type:float
static GKRule(*args)
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theGaussP (math_Vector &) –
  • theGaussW (math_Vector &) –
  • theKronrodP (math_Vector &) –
  • theKronrodW (math_Vector &) –
  • theValue (float &) –
  • theError (float &) –
Return type:

bool

IsDone()
  • Returns Standard_True if computation is performed successfully.
Return type:bool
NbIterReached()
  • Returns the number of iterations that were made to compute result.
Return type:int
OrderReached()
  • Returns the number of Kronrod points for which the result is computed.
Return type:int
Perform()
  • Computation of the integral. Takes the function, the lower and upper bound values, the initial number of Kronrod points, the relative tolerance value and the maximal number of iterations as parameters. theNbPnts should be odd and greater then or equal to 3.
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theNbPnts (int) –
Return type:

None

  • Computation of the integral. Takes the function, the lower and upper bound values, the initial number of Kronrod points, the relative tolerance value and the maximal number of iterations as parameters. theNbPnts should be odd and greater then or equal to 3. Note that theTolerance is relative, i.e. the criterion of solution reaching is: Abs(Kronrod - Gauss)/Abs(Kronrod) < theTolerance. theTolerance should be positive.
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theNbPnts (int) –
  • theTolerance (float) –
  • theMaxNbIter (int) –
Return type:

None

Value()
  • Returns the value of the integral.
Return type:float
thisown

The membership flag

math_KronrodSingleIntegration_GKRule(*args)
Parameters:
  • theFunction (math_Function &) –
  • theLower (float) –
  • theUpper (float) –
  • theGaussP (math_Vector &) –
  • theGaussW (math_Vector &) –
  • theKronrodP (math_Vector &) –
  • theKronrodW (math_Vector &) –
  • theValue (float &) –
  • theError (float &) –
Return type:

bool

class math_Matrix(*args)

Bases: object

  • Constructs a non-initialized matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] For the constructed matrix: - LowerRow and UpperRow are the indexes of the lower and upper bounds of a row, and - LowerCol and UpperCol are the indexes of the lower and upper bounds of a column.
Parameters:
  • LowerRow (int) –
  • UpperRow (int) –
  • LowerCol (int) –
  • UpperCol (int) –
Return type:

None

  • constructs a non-initialized matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] whose values are all initialized with the value InitialValue.
Parameters:
  • LowerRow (int) –
  • UpperRow (int) –
  • LowerCol (int) –
  • UpperCol (int) –
  • InitialValue (float) –
Return type:

None

  • constructs a matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] Sharing data with a ‘C array’ pointed by Tab.
Parameters:
  • Tab (Standard_Address) –
  • LowerRow (int) –
  • UpperRow (int) –
  • LowerCol (int) –
  • UpperCol (int) –
Return type:

None

  • constructs a matrix for copy in initialization. An exception is raised if the matrixes have not the same dimensions.
Parameters:Other (math_Matrix &) –
Return type:None
Add()
  • adds the matrix <Right> to a matrix. An exception is raised if the dimensions are different. Warning In order to save time when copying matrices, it is preferable to use operator += or the function Add whenever possible.
Parameters:Right (math_Matrix &) –
Return type:None
  • sets a matrix to the addition of <Left> and <Right>. An exception is raised if the dimensions are different.
Parameters:
  • Left (math_Matrix &) –
  • Right (math_Matrix &) –
Return type:

None

Added()
  • adds the matrix <Right> to a matrix. An exception is raised if the dimensions are different.
Parameters:Right (math_Matrix &) –
Return type:math_Matrix
Col()
  • Returns the column of index <Col> of a matrix.
Parameters:Col (int) –
Return type:math_Vector
ColNumber()
  • Returns the number of rows of this matrix. Note that for a matrix A you always have the following relations: - A.RowNumber() = A.UpperRow() - A.LowerRow() + 1 - A.ColNumber() = A.UpperCol() - A.LowerCol() + 1 - the length of a row of A is equal to the number of columns of A, - the length of a column of A is equal to the number of rows of A.returns the row range of a matrix.
Return type:int
Determinant()
  • Computes the determinant of a matrix. An exception is raised if the matrix is not a square matrix.
Return type:float
Divide()
  • divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.
Parameters:Right (float) –
Return type:None
Divided()
  • divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.
Parameters:Right (float) –
Return type:math_Matrix
DumpToString()

math_Matrix_DumpToString(math_Matrix self) -> std::string

Init()
  • Initialize all the elements of a matrix to InitialValue.
Parameters:InitialValue (float) –
Return type:None
Initialized()
  • Matrixes are copied through assignement. An exception is raised if the dimensions are differents.
Parameters:Other (math_Matrix &) –
Return type:math_Matrix
Inverse()
  • Returns the inverse of a matrix. Exception NotSquare is raised if the matrix is not square. Exception SingularMatrix is raised if the matrix is singular.
Return type:math_Matrix
Invert()
  • Inverts a matrix using Gauss algorithm. Exception NotSquare is raised if the matrix is not square. Exception SingularMatrix is raised if the matrix is singular.
Return type:None
LowerCol()
  • Returns the value of the Lower index of the column range of a matrix.
Return type:int
LowerRow()
  • Returns the value of the Lower index of the row range of a matrix.
Return type:int
Multiplied()
  • multiplies all the elements of a matrix by the value <Right>.
Parameters:Right (float) –
Return type:math_Matrix
  • Returns the product of 2 matrices. An exception is raised if the dimensions are different.
Parameters:Right (math_Matrix &) –
Return type:math_Matrix
  • Returns the product of a matrix by a vector. An exception is raised if the dimensions are different.
Parameters:Right (math_Vector &) –
Return type:math_Vector
Multiply()
  • Sets this matrix to the product of the matrix Left, and the matrix Right. Example math_Matrix A (1, 3, 1, 3); math_Matrix B (1, 3, 1, 3); // A = ... , B = ... math_Matrix C (1, 3, 1, 3); C.Multiply(A, B); Exceptions Standard_DimensionError if matrices are of incompatible dimensions, i.e. if: - the number of columns of matrix Left, or the number of rows of matrix TLeft is not equal to the number of rows of matrix Right, or - the number of rows of matrix Left, or the number of columns of matrix TLeft is not equal to the number of rows of this matrix, or - the number of columns of matrix Right is not equal to the number of columns of this matrix.
Parameters:Right (float) –
Return type:None
  • Computes a matrix as the product of 2 vectors. An exception is raised if the dimensions are different. <self> = <Left> * <Right>.
Parameters:
  • Left (math_Vector &) –
  • Right (math_Vector &) –
Return type:

None

  • Computes a matrix as the product of 2 matrixes. An exception is raised if the dimensions are different.
Parameters:
  • Left (math_Matrix &) –
  • Right (math_Matrix &) –
Return type:

None

  • Returns the product of 2 matrices. An exception is raised if the dimensions are different.
Parameters:Right (math_Matrix &) –
Return type:None
Opposite()
  • Returns the opposite of a matrix. An exception is raised if the dimensions are different.
Return type:math_Matrix
Row()
  • Returns the row of index Row of a matrix.
Parameters:Row (int) –
Return type:math_Vector
RowNumber()
  • Returns the number of rows of this matrix. Note that for a matrix A you always have the following relations: - A.RowNumber() = A.UpperRow() - A.LowerRow() + 1 - A.ColNumber() = A.UpperCol() - A.LowerCol() + 1 - the length of a row of A is equal to the number of columns of A, - the length of a column of A is equal to the number of rows of A.returns the row range of a matrix.
Return type:int
Set()
  • Sets the values of this matrix, - from index I1 to index I2 on the row dimension, and - from index J1 to index J2 on the column dimension, to those of matrix M. Exceptions Standard_DimensionError if: - I1 is less than the index of the lower row bound of this matrix, or - I2 is greater than the index of the upper row bound of this matrix, or - J1 is less than the index of the lower column bound of this matrix, or - J2 is greater than the index of the upper column bound of this matrix, or - I2 - I1 + 1 is not equal to the number of rows of matrix M, or - J2 - J1 + 1 is not equal to the number of columns of matrix M.
Parameters:
  • I1 (int) –
  • I2 (int) –
  • J1 (int) –
  • J2 (int) –
  • M (math_Matrix &) –
  • Other (math_Matrix &) –
Return type:

None

Return type:

math_Matrix

SetCol()
  • Sets the column of index Col of a matrix to the vector <V>. An exception is raised if the dimensions are different. An exception is raises if <Col> is inferior to the lower column of the matrix or <Col> is superior to the upper column.
Parameters:
  • Col (int) –
  • V (math_Vector &) –
Return type:

None

SetDiag()
  • Sets the diagonal of a matrix to the value <Value>. An exception is raised if the matrix is not square.
Parameters:Value (float) –
Return type:None
SetRow()
  • Sets the row of index Row of a matrix to the vector <V>. An exception is raised if the dimensions are different. An exception is raises if <Row> is inferior to the lower row of the matrix or <Row> is superior to the upper row.
Parameters:
  • Row (int) –
  • V (math_Vector &) –
Return type:

None

Subtract()
  • Subtracts the matrix <Right> from <self>. An exception is raised if the dimensions are different. Warning In order to avoid time-consuming copying of matrices, it is preferable to use operator -= or the function Subtract whenever possible.
Parameters:Right (math_Matrix &) –
Return type:None
  • Sets a matrix to the Subtraction of the matrix <Right> from the matrix <Left>. An exception is raised if the dimensions are different.
Parameters:
  • Left (math_Matrix &) –
  • Right (math_Matrix &) –
Return type:

None

Subtracted()
  • Returns the result of the subtraction of <Right> from <self>. An exception is raised if the dimensions are different.
Parameters:Right (math_Matrix &) –
Return type:math_Matrix
SwapCol()
  • Swaps the columns of index <Col1> and <Col2>. An exception is raised if <Col1> or <Col2> is out of range.
Parameters:
  • Col1 (int) –
  • Col2 (int) –
Return type:

None

SwapRow()
  • Swaps the rows of index Row1 and Row2. An exception is raised if <Row1> or <Row2> is out of range.
Parameters:
  • Row1 (int) –
  • Row2 (int) –
Return type:

None

TMultiplied()
  • Sets this matrix to the product of the transposed matrix TLeft, and the matrix Right. Example math_Matrix A (1, 3, 1, 3); math_Matrix B (1, 3, 1, 3); // A = ... , B = ... math_Matrix C (1, 3, 1, 3); C.Multiply(A, B); Exceptions Standard_DimensionError if matrices are of incompatible dimensions, i.e. if: - the number of columns of matrix Left, or the number of rows of matrix TLeft is not equal to the number of rows of matrix Right, or - the number of rows of matrix Left, or the number of columns of matrix TLeft is not equal to the number of rows of this matrix, or - the number of columns of matrix Right is not equal to the number of columns of this matrix.
Parameters:Right (float) –
Return type:math_Matrix
TMultiply()
  • Returns the product of the transpose of a matrix with the matrix <Right>. An exception is raised if the dimensions are different.
Parameters:Right (math_Matrix &) –
Return type:math_Matrix
  • Computes a matrix to the product of the transpose of the matrix <TLeft> with the matrix <Right>. An exception is raised if the dimensions are different.
Parameters:
  • TLeft (math_Matrix &) –
  • Right (math_Matrix &) –
Return type:

None

Transpose()
  • Transposes a given matrix. An exception is raised if the matrix is not a square matrix.
Return type:None
Transposed()
  • Teturns the transposed of a matrix. An exception is raised if the matrix is not a square matrix.
Return type:math_Matrix
UpperCol()
  • Returns the value of the upper index of the column range of a matrix.
Return type:int
UpperRow()
  • Returns the Upper index of the row range of a matrix.
Return type:int
Value()
  • Accesses (in read or write mode) the value of index <Row> and <Col> of a matrix. An exception is raised if <Row> and <Col> are not in the correct range.
Parameters:
Return type:

float

thisown

The membership flag

class math_MultipleVarFunction(*args, **kwargs)

Bases: object

Delete()
Return type:void
GetStateNumber()
  • return the state of the function corresponding to the latestt call of any methods associated to the function. This function is called by each of the algorithms described later which define the function Integer Algorithm::StateNumber(). The algorithm has the responsibility to call this function when it has found a solution (i.e. a root or a minimum) and has to maintain the association between the solution found and this StateNumber. Byu default, this method returns 0 (which means for the algorithm: no state has been saved). It is the responsibility of the programmer to decide if he needs to save the current state of the function and to return an Integer that allows retrieval of the state.
Return type:int
NbVariables()
  • Returns the number of variables of the function
Return type:int
Value()
  • Computes the values of the Functions <F> for the variable <X>. returns True if the computation was done successfully, otherwise false.
Parameters:
  • X (math_Vector &) –
  • F (float &) –
Return type:

bool

thisown

The membership flag

class math_MultipleVarFunctionWithGradient(*args, **kwargs)

Bases: OCC.math.math_MultipleVarFunction

Gradient()
  • Computes the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • G (math_Vector &) –
Return type:

bool

Values()
  • computes the value <F> and the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • F (float &) –
  • G (math_Vector &) –
Return type:

bool

thisown

The membership flag

class math_MultipleVarFunctionWithHessian(*args, **kwargs)

Bases: OCC.math.math_MultipleVarFunctionWithGradient

Values()
  • computes the value <F> and the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • F (float &) –
  • G (math_Vector &) –
Return type:

bool

  • computes the value <F>, the gradient <G> and the hessian <H> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.
Parameters:
  • X (math_Vector &) –
  • F (float &) –
  • G (math_Vector &) –
  • H (math_Matrix &) –
Return type:

bool

thisown

The membership flag

class math_NewtonFunctionRoot(*args)

Bases: object

  • The Newton method is done to find the root of the function F from the initial guess Guess. The tolerance required on the root is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= EpsX and abs(F(Xi))<= EpsF The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Guess (float) –
  • EpsX (float) –
  • EpsF (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • The Newton method is done to find the root of the function F from the initial guess Guess. The solution must be inside the interval [A, B]. The tolerance required on the root is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= EpsX and abs(F(Xi))<= EpsF The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Guess (float) –
  • EpsX (float) –
  • EpsF (float) –
  • A (float) –
  • B (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • is used in a sub-class to initialize correctly all the fields of this class.
Parameters:
Return type:

None

Derivative()
  • returns the value of the derivative at the root. Exception NotDone is raised if the root was not found.
Return type:float
DumpToString()

math_NewtonFunctionRoot_DumpToString(math_NewtonFunctionRoot self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbIterations()
  • Returns the number of iterations really done on the computation of the Root. Exception NotDone is raised if the root was not found.
Return type:int
Perform()
  • is used internally by the constructors.
Parameters:
  • F (math_FunctionWithDerivative &) –
  • Guess (float) –
Return type:

None

Root()
  • Returns the value of the root of function <F>. Exception NotDone is raised if the root was not found.
Return type:float
Value()
  • returns the value of the function at the root. Exception NotDone is raised if the root was not found.
Return type:float
thisown

The membership flag

class math_NewtonFunctionSetRoot(*args)

Bases: object

  • This constructor should be 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.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • XTol (math_Vector &) –
  • FTol (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • This constructor should be 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 before performing the algorithm.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • FTol (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • The Newton method is done to improve the root of the function F from the initial guess StartingPoint. The tolerance required on the root is given by Tolerance. The solution is found when : abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • XTol (math_Vector &) –
  • FTol (float) –
  • NbIterations (int) – default value is 100
Return type:

None

  • The Newton method is done to improve the root of the function F from the initial guess StartingPoint. The tolerance required on the root is given by Tolerance. The solution is found when : abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i; The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • InfBound (math_Vector &) –
  • SupBound (math_Vector &) –
  • XTol (math_Vector &) –
  • FTol (float) –
  • NbIterations (int) – default value is 100
Return type:

None

Delete()
Return type:void
Derivative()
  • Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.
Return type:math_Matrix
  • 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 range of Der is not equal to the range of the StartingPoint.
Parameters:Der (math_Matrix &) –
Return type:None
DumpToString()

math_NewtonFunctionSetRoot_DumpToString(math_NewtonFunctionSetRoot self) -> std::string

FunctionSetErrors()
  • Returns the vector value of the error done on the functions at the root. Exception NotDone is raised if the root was not found.
Return type:math_Vector
  • 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.
Parameters:Err (math_Vector &) –
Return type:None
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • This method is called at the end of each iteration to check if the solution is found. Vectors DeltaX, Fvalues and Jacobian Matrix are consistent with the possible solution Vector Sol and can be inspected to decide whether the solution is reached or not.
Parameters:F (math_FunctionSetWithDerivatives &) –
Return type:bool
NbIterations()
  • Returns the number of iterations really done during the computation of the Root. Exception NotDone is raised if the root was not found.
Return type:int
Perform()
  • Improves the root of function F from the initial guess StartingPoint. infBound and supBound may be given, to constrain the solution. Warning This method must be called when the solution is not computed by the constructors.
Parameters:
  • F (math_FunctionSetWithDerivatives &) –
  • StartingPoint (math_Vector &) –
  • InfBound (math_Vector &) –
  • SupBound (math_Vector &) –
Return type:

None

Root()
  • Returns the value of the root of function F. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
Return type:math_Vector
  • 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.
Parameters:Root (math_Vector &) –
Return type:None
SetTolerance()
  • Initializes the tolerance values for the unknowns.
Parameters:XTol (math_Vector &) –
Return type:None
thisown

The membership flag

class math_NewtonMinimum(*args)

Bases: object

  • – Given the starting point StartingPoint, The tolerance required on the solution is given by Tolerance. Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite positive (if the smaller eigenvalue of H < Convexity) or IsConverged() returns True for 2 successives Iterations. Warning: Obsolete Constructor (because IsConverged can not be redefined with this. )
Parameters:
  • F (math_MultipleVarFunctionWithHessian &) –
  • StartingPoint (math_Vector &) –
  • Tolerance (float) – default value is 1.0e-7
  • NbIterations (int) – default value is 40
  • Convexity (float) – default value is 1.0e-6
  • WithSingularity (bool) – default value is Standard_True
Return type:

None

  • The tolerance required on the solution is given by Tolerance. Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite positive (if the smaller eigenvalue of H < Convexity) or IsConverged() returns True for 2 successives Iterations. Warning: This constructor do not computation
Parameters:
  • F (math_MultipleVarFunctionWithHessian &) –
  • Tolerance (float) – default value is 1.0e-7
  • NbIterations (int) – default value is 40
  • Convexity (float) – default value is 1.0e-6
  • WithSingularity (bool) – default value is Standard_True
Return type:

None

Delete()
Return type:void
DumpToString()

math_NewtonMinimum_DumpToString(math_NewtonMinimum self) -> std::string

Gradient()
  • returns the gradient vector at the minimum. Exception NotDone is raised if an error has occured.the minimum was not found.
Return type:math_Vector
  • outputs the gradient vector at the minimum in Grad. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Grad is not equal to the range of the StartingPoint.
Parameters:Grad (math_Vector &) –
Return type:None
IsConverged()
  • This method is called at the end of each iteration to check the convergence : || Xi+1 - Xi || < Tolerance or || F(Xi+1) - F(Xi)|| < Tolerance * || F(Xi) || It can be redefined in a sub-class to implement a specific test.
Return type:bool
IsDone()
  • Tests if an error has occured.
Return type:bool
Location()
  • returns the location vector of the minimum. Exception NotDone is raised if an error has occured.
Return type:math_Vector
  • outputs the location vector of the minimum in Loc. Exception NotDone is raised if an error has occured. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.
Parameters:Loc (math_Vector &) –
Return type:None
Minimum()
  • returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
NbIterations()
  • returns the number of iterations really done in the calculation of the minimum. The exception NotDone is raised if an error has occured.
Return type:int
Perform()
  • Search the solution.
Parameters:
  • F (math_MultipleVarFunctionWithHessian &) –
  • StartingPoint (math_Vector &) –
Return type:

None

thisown

The membership flag

math_OrderedGaussPointsAndWeights(*args)
  • Returns a vector of Gauss points and a vector of their weights. The difference with the method GaussPoints is the following: - the points are returned in increasing order. - if Index is greater then GaussPointsMax, the points are computed. Returns Standard_True if Index is positive, Points’ and Weights’ length is equal to Index, Points and Weights are successfully computed.
Parameters:
  • Index (int) –
  • Points (math_Vector &) –
  • Weights (math_Vector &) –
Return type:

bool

class math_PSO(*args)

Bases: object

  • /** * Constructor. * * @param theFunc defines the objective function. It should exist during all lifetime of class instance. * @param theLowBorder defines lower border of search space. * @param theUppBorder defines upper border of search space. * @param theSteps defines steps of regular grid, used for particle generation. This parameter used to define stop condition (TerminalVelocity). * @param theNbParticles defines number of particles. * @param theNbIter defines maximum number of iterations. */
Parameters:
  • theFunc (math_MultipleVarFunction *) –
  • theLowBorder (math_Vector &) –
  • theUppBorder (math_Vector &) –
  • theSteps (math_Vector &) –
  • theNbParticles (int) – default value is 32
  • theNbIter (int) – default value is 100
Return type:

None

Perform()
  • Perform computations, particles array is constructed inside of this function.
Parameters:
  • theSteps (math_Vector &) –
  • theValue (float &) –
  • theOutPnt (math_Vector &) –
  • theNbIter (int) – default value is 100
Return type:

None

  • Perform computations with given particles array.
Parameters:
  • theParticles (math_PSOParticlesPool &) –
  • theNbParticles (int) –
  • theValue (float &) –
  • theOutPnt (math_Vector &) –
  • theNbIter (int) – default value is 100
Return type:

None

thisown

The membership flag

class math_PSOParticlesPool(*args)

Bases: object

Parameters:
  • theParticlesCount (int) –
  • theDimensionCount (int) –
Return type:

None

GetBestParticle()
Return type:PSO_Particle *
GetParticle()
Parameters:theIdx (int) –
Return type:PSO_Particle *
GetWorstParticle()
Return type:PSO_Particle *
thisown

The membership flag

class math_Powell(*args)

Bases: object

  • Computes Powell minimization on the function F given StartingPoint, and an initial matrix StartingDirection whose columns contain the initial set of directions. The solution F = Fi is found when 2.0 * abs(Fi - Fi-1) = <Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). The maximum number of iterations allowed is given by NbIterations.
Parameters:
  • F (math_MultipleVarFunction &) –
  • StartingPoint (math_Vector &) –
  • StartingDirections (math_Matrix &) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

  • is used in a sub-class to initialize correctly all the fields of this class.
Parameters:
  • F (math_MultipleVarFunction &) –
  • Tolerance (float) –
  • NbIterations (int) – default value is 200
  • ZEPS (float) – default value is 1.0e-12
Return type:

None

Delete()
Return type:void
DumpToString()

math_Powell_DumpToString(math_Powell self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
IsSolutionReached()
  • solution F = Fi is found when : 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS. The maximum number of iterations allowed is given by NbIterations.
Parameters:F (math_MultipleVarFunction &) –
Return type:bool
Location()
  • returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:math_Vector
  • outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.
Parameters:Loc (math_Vector &) –
Return type:None
Minimum()
  • Returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:float
NbIterations()
  • Returns the number of iterations really done during the computation of the minimum. Exception NotDone is raised if the minimum was not found.
Return type:int
Perform()
  • Use this method after a call to the initialization constructor to compute the minimum of function F. Warning The initialization constructor must have been called before the Perform method is called.
Parameters:
  • F (math_MultipleVarFunction &) –
  • StartingPoint (math_Vector &) –
  • StartingDirections (math_Matrix &) –
Return type:

None

thisown

The membership flag

class math_QuickSortOfValueAndWeight

Bases: object

static Sort(*args)
Parameters:
  • TheArray (math_Array1OfValueAndWeight &) –
  • Comp (math_CompareOfValueAndWeight &) –
Return type:

void

thisown

The membership flag

math_QuickSortOfValueAndWeight_Sort(*args)
Parameters:
  • TheArray (math_Array1OfValueAndWeight &) –
  • Comp (math_CompareOfValueAndWeight &) –
Return type:

void

class math_RealRandom(*args)

Bases: object

  • creates a real random generator between the values Lower and Upper.
Parameters:
Return type:

None

Next()
  • returns the next random number.
Return type:float
Reset()
  • reinitializes the random generator
Return type:None
thisown

The membership flag

class math_SVD(*args)

Bases: object

  • Given as input an n X m matrix A with n < m, n = m or n > m this constructor performs the Singular Value Decomposition.
Parameters:A (math_Matrix &) –
Return type:None
DumpToString()

math_SVD_DumpToString(math_SVD self) -> std::string

IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
PseudoInverse()
  • Computes the inverse Inv of matrix A such as A * Inverse = Identity. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false). Standard_DimensionError if the ranges of Inv are compatible with the ranges of A.
Parameters:
  • Inv (math_Matrix &) –
  • Eps (float) – default value is 1.0e-6
Return type:

None

Solve()
  • Given the input Vector B this routine solves the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the rowrange of A. Exception DimensionError is raised if the range of X is not equal to the colrange of A.
Parameters:
  • B (math_Vector &) –
  • X (math_Vector &) –
  • Eps (float) – default value is 1.0e-6
Return type:

None

thisown

The membership flag

class math_TrigonometricFunctionRoots(*args)

Bases: object

  • Given coefficients a, b, c, d , e, this constructor performs the resolution of the equation above. The solutions must be contained in [InfBound, SupBound]. InfBound and SupBound can be set by default to 0 and 2*PI.
Parameters:
Return type:

None

  • Given the two coefficients d and e, it performs the resolution of d*sin(x) + e = 0. The solutions must be contained in [InfBound, SupBound]. InfBound and SupBound can be set by default to 0 and 2*PI.
Parameters:
Return type:

None

  • Given the three coefficients c, d and e, it performs the resolution of 2*b*cos(x)*sin(x) + d*sin(x) + e = 0. The solutions must be contained in [InfBound, SupBound]. InfBound and SupBound can be set by default to 0 and 2*PI.
Parameters:
Return type:

None

DumpToString()

math_TrigonometricFunctionRoots_DumpToString(math_TrigonometricFunctionRoots self) -> std::string

InfiniteRoots()
  • Returns true if there is an infinity of roots, otherwise returns false.
Return type:bool
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbSolutions()
  • Returns the number of solutions found. An exception is raised if NotDone. An exception is raised if there is an infinity of solutions.
Return type:int
Value()
  • Returns the solution of range Index. An exception is raised if NotDone. An exception is raised if Index>NbSolutions. An exception is raised if there is an infinity of solutions.
Parameters:Index (int) –
Return type:float
thisown

The membership flag

class math_Uzawa(*args)

Bases: object

  • Given an input matrix Cont, two input vectors Secont and StartingPoint, it solves Cont*X = Secont (only = equations) with a minimization of Norme(X-X0). The maximun iterations number allowed is fixed to NbIterations. The tolerance EpsLic is fixed for the dual variable convergence. The tolerance EpsLix is used for the convergence of X. Exception ConstuctionError is raised if the line number of Cont is different from the length of Secont.
Parameters:
  • Cont (math_Matrix &) –
  • Secont (math_Vector &) –
  • StartingPoint (math_Vector &) –
  • EpsLix (float) – default value is 1.0e-06
  • EpsLic (float) – default value is 1.0e-06
  • NbIterations (int) – default value is 500
Return type:

None

  • Given an input matrix Cont, two input vectors Secont and StartingPoint, it solves Cont*X = Secont (the Nce first equations are equal equations and the Nci last equations are inequalities <) with a minimization of Norme(X-X0). The maximun iterations number allowed is fixed to NbIterations. The tolerance EpsLic is fixed for the dual variable convergence. The tolerance EpsLix is used for the convergence of X. There are no conditions on Nce and Nci. Exception ConstuctionError is raised if the line number of Cont is different from the length of Secont and from Nce + Nci.
Parameters:
  • Cont (math_Matrix &) –
  • Secont (math_Vector &) –
  • StartingPoint (math_Vector &) –
  • Nci (int) –
  • Nce (int) –
  • EpsLix (float) – default value is 1.0e-06
  • EpsLic (float) – default value is 1.0e-06
  • NbIterations (int) – default value is 500
Return type:

None

Duale()
  • returns the duale variables V of the systeme.
Parameters:V (math_Vector &) –
Return type:None
DumpToString()

math_Uzawa_DumpToString(math_Uzawa self) -> std::string

Error()
  • Returns the difference between X solution and the StartingPoint. An exception is raised if NotDone.
Return type:math_Vector
InitialError()
  • Returns the initial error Cont*StartingPoint-Secont. An exception is raised if NotDone.
Return type:math_Vector
InverseCont()
  • returns the inverse matrix of (C * Transposed(C)). This result is needed for the computation of the gradient when approximating a curve.
Return type:math_Matrix
IsDone()
  • Returns true if the computations are successful, otherwise returns false.
Return type:bool
NbIterations()
  • returns the number of iterations really done. An exception is raised if NotDone.
Return type:int
Value()
  • Returns the vector solution of the system above. An exception is raised if NotDone.
Return type:math_Vector
thisown

The membership flag

class math_ValueAndWeight(*args)

Bases: object

Return type:

None

Parameters:
Return type:

None

Value()
Return type:float
Weight()
Return type:float
thisown

The membership flag

class math_Vector(*args)

Bases: object

  • Contructs a non-initialized vector in the range [theLower..theUpper] ‘theLower’ and ‘theUpper’ are the indexes of the lower and upper bounds of the constructed vector.
Parameters:
  • theLower (int) –
  • theUpper (int) –
Return type:

None

  • Contructs a vector in the range [theLower..theUpper] whose values are all initialized with the value ‘theInitialValue’
Parameters:
  • theLower (int) –
  • theUpper (int) –
  • theInitialValue (float) –
Return type:

None

  • Constructs a vector in the range [theLower..theUpper] with the ‘c array’ theTab.
Parameters:
  • theTab (Standard_Address) –
  • theLower (int) –
  • theUpper (int) –
Return type:

None

  • Constructs a copy for initialization. An exception is raised if the lengths of the vectors are different.
Parameters:theOther (math_Vector &) –
Return type:None
Add()
  • adds the vector ‘theRight’ to a vector. An exception is raised if the vectors have not the same length. Warning In order to avoid time-consuming copying of vectors, it is preferable to use operator += or the function Add whenever possible.
Parameters:theRight (math_Vector &) –
Return type:None
  • sets a vector to the sum of the vector ‘theLeft’ and the vector ‘theRight’. An exception is raised if the lengths are different.
Parameters:
  • theLeft (math_Vector &) –
  • theRight (math_Vector &) –
Return type:

None

Added()
  • adds the vector theRight to a vector. An exception is raised if the vectors have not the same length. An exception is raised if the lengths are not equal.
Parameters:theRight (math_Vector &) –
Return type:math_Vector
Divide()
  • divides a vector by the value ‘theRight’. An exception is raised if ‘theRight’ = 0.
Parameters:theRight (float) –
Return type:None
Divided()
  • divides a vector by the value ‘theRight’. An exception is raised if ‘theRight’ = 0.
Parameters:theRight (float) –
Return type:math_Vector
DumpToString()

math_Vector_DumpToString(math_Vector self) -> std::string

Init()
  • Initialize all the elements of a vector with ‘theInitialValue’.
Parameters:theInitialValue (float) –
Return type:None
Initialized()
  • Initialises a vector by copying ‘theOther’. An exception is raised if the Lengths are differents.
Parameters:theOther (math_Vector &) –
Return type:math_Vector
Inverse()
  • Inverts this vector and creates a new vector.
Return type:math_Vector
Invert()
  • Inverts this vector and assigns the result to this vector.
Return type:None
Length()
  • Returns the length of a vector
Return type:inline int
Lower()
  • Returns the value of the theLower index of a vector.
Return type:inline int
Max()
  • Returns the value of the ‘Index’ of the maximum element of a vector.
Return type:int
Min()
  • Returns the value of the ‘Index’ of the minimum element of a vector.
Return type:int
Multiplied()
  • returns the product of a vector and a real value.
Parameters:theRight (float) –
Return type:math_Vector
  • returns the inner product of 2 vectors. An exception is raised if the lengths are not equal.
Parameters:theRight (math_Vector &) –
Return type:float
  • returns the product of a vector by a matrix.
Parameters:theRight (math_Matrix &) –
Return type:math_Vector
Multiply()
  • returns the product of a vector and a real value.
Parameters:theRight (float) –
Return type:None
  • sets a vector to the product of the vector ‘theLeft’ with the matrix ‘theRight’.
Parameters:
  • theLeft (math_Vector &) –
  • theRight (math_Matrix &) –
Return type:

None

  • //!sets a vector to the product of the matrix ‘theLeft’ with the vector ‘theRight’.
Parameters:
  • theLeft (math_Matrix &) –
  • theRight (math_Vector &) –
Return type:

None

  • returns the multiplication of a real by a vector. ‘me’ = ‘theLeft’ * ‘theRight’
Parameters:
  • theLeft (float) –
  • theRight (math_Vector &) –
Return type:

None

Norm()
  • Returns the value or the square of the norm of this vector.
Return type:float
Norm2()
  • Returns the value of the square of the norm of a vector.
Return type:float
Normalize()
  • Normalizes this vector (the norm of the result is equal to 1.0) and assigns the result to this vector Exceptions Standard_NullValue if this vector is null (i.e. if its norm is less than or equal to Standard_Real::RealEpsilon().
Return type:None
Normalized()
  • Normalizes this vector (the norm of the result is equal to 1.0) and creates a new vector Exceptions Standard_NullValue if this vector is null (i.e. if its norm is less than or equal to Standard_Real::RealEpsilon().
Return type:math_Vector
Opposite()
  • returns the opposite of a vector.
Return type:math_Vector
Set()
  • sets a vector from ‘theI1’ to ‘theI2’ to the vector ‘theV’; An exception is raised if ‘theI1’ is less than ‘LowerIndex’ or ‘theI2’ is greater than ‘UpperIndex’ or ‘theI1’ is greater than ‘theI2’. An exception is raised if ‘theI2-theI1+1’ is different from the ‘Length’ of ‘theV’.
Parameters:
  • theI1 (int) –
  • theI2 (int) –
  • theV (math_Vector &) –
  • theOther (math_Vector &) –
Return type:

None

Return type:

math_Vector

Slice()
  • //!Creates a new vector by inverting the values of this vector between indexes ‘theI1’ and ‘theI2’. If the values of this vector were (1., 2., 3., 4.,5., 6.), by slicing it between indexes 2 and 5 the values of the resulting vector are (1., 5., 4., 3., 2., 6.)
Parameters:
  • theI1 (int) –
  • theI2 (int) –
Return type:

math_Vector

Subtract()
  • sets a vector to the Subtraction of the vector theRight from the vector theLeft. An exception is raised if the vectors have not the same length. Warning In order to avoid time-consuming copying of vectors, it is preferable to use operator -= or the function Subtract whenever possible.
Parameters:
  • theLeft (math_Vector &) –
  • theRight (math_Vector &) –
Return type:

None

  • returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the vectors have not the same length.
Parameters:theRight (math_Vector &) –
Return type:None
Subtracted()
  • returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the vectors have not the same length.
Parameters:theRight (math_Vector &) –
Return type:math_Vector
TMultiplied()
  • returns the product of a vector and a real value.
Parameters:theRight (float) –
Return type:math_Vector
TMultiply()
  • sets a vector to the product of the transpose of the matrix ‘theTLeft’ by the vector ‘theRight’.
Parameters:
  • theTLeft (math_Matrix &) –
  • theRight (math_Vector &) –
Return type:

None

  • sets a vector to the product of the vector ‘theLeft’ by the transpose of the matrix ‘theTRight’.
Parameters:
  • theLeft (math_Vector &) –
  • theTRight (math_Matrix &) –
Return type:

None

Upper()
  • Returns the value of the theUpper index of a vector.
Return type:inline int
Value()
  • accesses (in read or write mode) the value of index ‘theNum’ of a vector.
Parameters:theNum (int) –
Return type:inline float
thisown

The membership flag

register_handle(handle, base_object)

Inserts the handle into the base object to prevent memory corruption in certain cases