OCC.Core.math module¶
math module, see official documentation at https://www.opencascade.com/doc/occt-7.4.0/refman/html/package_math.html
-
class
SwigPyIterator
(*args, **kwargs)¶ Bases:
object
-
advance
()¶
-
copy
()¶
-
decr
()¶
-
distance
()¶
-
equal
()¶
-
incr
()¶
-
next
()¶
-
previous
()¶
-
property
thisown
¶ The membership flag
-
value
()¶
-
-
class
math
¶ Bases:
object
-
static
GaussPoints
()¶ - Parameters
Index –
- type Index
int
- param Points
- type Points
math_Vector
- rtype
void
-
static
GaussWeights
()¶ - Parameters
Index –
- type Index
int
- param Weights
- type Weights
math_Vector
- rtype
void
-
static
KronrodPointsAndWeights
()¶ - 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.
- param Index
- type Index
int
- param Points
- type Points
math_Vector
- param Weights
- type Weights
math_Vector
- rtype
bool
-
static
KronrodPointsMax
()¶ - 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.
- rtype
int
-
static
OrderedGaussPointsAndWeights
()¶ - 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.
- param Index
- type Index
int
- param Points
- type Points
math_Vector
- param Weights
- type Weights
math_Vector
- rtype
bool
-
property
thisown
¶ The membership flag
-
static
-
class
math_Array1OfValueAndWeight
(*args)¶ Bases:
object
-
Assign
()¶
-
ChangeFirst
()¶
-
ChangeLast
()¶
-
ChangeValue
()¶
-
First
()¶
-
Init
()¶
-
IsAllocated
()¶
-
IsDeletable
()¶
-
IsEmpty
()¶
-
Last
()¶
-
Length
()¶
-
Lower
()¶
-
Move
()¶
-
Resize
()¶
-
Set
()¶
-
SetValue
()¶
-
Size
()¶
-
Upper
()¶
-
Value
()¶
-
begin
()¶
-
cbegin
()¶
-
cend
()¶
-
end
()¶
-
next
()¶
-
property
thisown
¶ The membership flag
-
-
class
math_BFGS
(*args)¶ Bases:
object
- Initializes the computation of the minimum of a function with NbVariables. Tolerance, ZEPS and NbIterations are described in the method Perform. Warning: A call to the Perform method must be made after this initialization to effectively compute the minimum of the function F.
- param NbVariables
- type NbVariables
int
- param Tolerance
default value is 1.0e-8
- type Tolerance
float
- param NbIterations
default value is 200
- type NbIterations
int
- param ZEPS
default value is 1.0e-12
- type ZEPS
float
- rtype
None
-
DumpToString
(math_BFGS self) → std::string¶
-
Gradient
()¶ - Returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- param Grad
- type Grad
math_Vector
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param F
- type F
math_MultipleVarFunctionWithGradient
- rtype
bool
-
Location
()¶ - returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- param Loc
- type Loc
math_Vector
- rtype
None
-
Minimum
()¶ - returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- rtype
int
-
Perform
()¶ - Given the starting point StartingPoint, minimization is done on the function F. The solution F = Fi is found when2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). Tolerance, ZEPS and maximum number of iterations are given in the constructor.
- param F
- type F
math_MultipleVarFunctionWithGradient
- param StartingPoint
- type StartingPoint
math_Vector
- rtype
None
-
SetBoundary
()¶ - Set boundaries for conditional optimization. The expected indices range of vectors is [1, NbVariables].
- param theLeftBorder
- type theLeftBorder
math_Vector
- param theRightBorder
- type theRightBorder
math_Vector
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_BissecNewton
(*args)¶ Bases:
object
- Constructor. @param theXTolerance - algorithm tolerance.
- param theXTolerance
- type theXTolerance
float
- rtype
None
-
Derivative
()¶ - returns the value of the derivative at the root. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
DumpToString
(math_BissecNewton self) → std::string¶
-
IsDone
()¶ - Tests is the root has been successfully found.
- rtype
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.
- param theFunction
- type theFunction
math_FunctionWithDerivative
- rtype
bool
-
Perform
()¶ - 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.
- param F
- type F
math_FunctionWithDerivative
- param Bound1
- type Bound1
float
- param Bound2
- type Bound2
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
None
-
Root
()¶ - returns the value of the root. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
Value
()¶ - returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
property
thisown
¶ The membership flag
-
class
math_BracketMinimum
(*args)¶ Bases:
object
- Constructor preparing A and B parameters only. It does not perform the job.
- param A
- type A
float
- param B
- type B
float
- rtype
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.
- param F
- type F
math_Function
- param A
- type A
float
- param B
- type B
float
- rtype
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.
- param F
- type F
math_Function
- param A
- type A
float
- param B
- type B
float
- param FA
- type FA
float
- rtype
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.
- param F
- type F
math_Function
- param A
- type A
float
- param B
- type B
float
- param FA
- type FA
float
- param FB
- type FB
float
- rtype
None
-
DumpToString
(math_BracketMinimum self) → std::string¶
-
FunctionValues
()¶ - returns the bracketed triplet function values. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
- param FA
- type FA
float
- param FB
- type FB
float
- param FC
- type FC
float
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
bool
-
Perform
()¶ - The method performing the job. It is called automatically by constructors with the function.
- param F
- type F
math_Function
- rtype
None
-
SetFA
()¶ - Set function value at A
- param theValue
- type theValue
float
- rtype
None
-
SetFB
()¶ - Set function value at B
- param theValue
- type theValue
float
- rtype
None
-
SetLimits
()¶ - Set limits of the parameter. By default no limits are applied to the parameter change. If no minimum is found in limits then IsDone() will return false. The user is in charge of providing A and B to be in limits.
- param theLeft
- type theLeft
float
- param theRight
- type theRight
float
- rtype
None
-
Values
()¶ - Returns the bracketed triplet of abscissae. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
- param A
- type A
float
- param B
- type B
float
- param C
- type C
float
- rtype
None
-
property
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 whenabs(Xi - Xi-1) <= Tolerance; The maximum number of iterations allowed is given by NbIterations.
- param F
- type F
math_Function
- param Bound1
- type Bound1
float
- param Bound2
- type Bound2
float
- param Tolerance
- type Tolerance
float
- param NbIterations
default value is 100
- type NbIterations
int
- param ZEPS
default value is 1.0e-12
- type ZEPS
float
- rtype
None
-
DumpToString
(math_BracketedRoot self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- rtype
int
-
Root
()¶ - returns the value of the root. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
Value
()¶ - returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
property
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.
- param TolX
- type TolX
float
- param NbIterations
default value is 100
- type NbIterations
int
- param ZEPS
default value is 1.0e-12
- type ZEPS
float
- rtype
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.
- param TolX
- type TolX
float
- param Fbx
- type Fbx
float
- param NbIterations
default value is 100
- type NbIterations
int
- param ZEPS
default value is 1.0e-12
- type ZEPS
float
- rtype
None
-
DumpToString
(math_BrentMinimum self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param theFunction
- type theFunction
math_Function
- rtype
bool
-
Location
()¶ - returns the location value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
float
-
Minimum
()¶ - returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- rtype
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)) The solution is found when: abs(Xi - Xi-1) <= TolX * abs(Xi) + ZEPS;
- param F
- type F
math_Function
- param Ax
- type Ax
float
- param Bx
- type Bx
float
- param Cx
- type Cx
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_BullardGenerator
(*args)¶ Bases:
object
- Creates new Xorshift 64-bit RNG.
- param theSeed
default value is 1
- type theSeed
unsigned int
- rtype
None
-
NextInt
()¶ - Generates new 64-bit integer value.
- rtype
unsigned int
-
NextReal
()¶ - Generates new floating-point value.
- rtype
float
-
SetSeed
()¶ - Setup new seed / reset defaults.
- param theSeed
default value is 1
- type theSeed
unsigned int
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_ComputeGaussPointsAndWeights
(*args)¶ Bases:
object
- Parameters
Number –
- type Number
int
- rtype
None
-
Points
()¶ - Return type
-
Weights
()¶ - Return type
-
property
thisown
¶ The membership flag
-
class
math_ComputeKronrodPointsAndWeights
(*args)¶ Bases:
object
- Parameters
Number –
- type Number
int
- rtype
None
-
Points
()¶ - Return type
-
Weights
()¶ - Return type
-
property
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.
- param A
- type A
math_Matrix
- param MinPivot
default value is 1.0e-20
- type MinPivot
float
- rtype
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).
- rtype
float
-
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.
- rtype
math_Matrix
-
Invert
()¶ - returns in Inv the inverse matrix of A. Only the inferior triangle is returned. Exception NotDone is raised if NotDone.
- param Inv
- type Inv
math_Matrix
- rtype
None
-
IsDone
()¶ - Returns True if all has been correctly done.
- rtype
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.
- param B
- type B
math_Vector
- param X
- type X
math_Vector
- rtype
None
-
property
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.
- param A
- type A
float
- param B
- type B
float
- param C
- type C
float
- param D
- type D
float
- param E
- type E
float
- rtype
None* computes all the real roots of the polynomial Ax3 + Bx2 + Cx + D using a direct method.
- param A
- type A
float
- param B
- type B
float
- param C
- type C
float
- param D
- type D
float
- rtype
None* computes all the real roots of the polynomial Ax2 + Bx + C using a direct method.
- param A
- type A
float
- param B
- type B
float
- param C
- type C
float
- rtype
None* computes the real root of the polynomial Ax + B.
- param A
- type A
float
- param B
- type B
float
- rtype
None
-
DumpToString
(math_DirectPolynomialRoots self) → std::string¶
-
InfiniteRoots
()¶ - Returns true if there is an infinity of roots, otherwise returns false.
- rtype
bool
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
bool
-
NbSolutions
()¶ - returns the number of solutions. An exception is raised if there are an infinity of roots.
- rtype
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.
- param Nieme
- type Nieme
int
- rtype
float
-
property
thisown
¶ The membership flag
-
class
math_DoubleTab
(*args)¶ Bases:
object
- Parameters
LowerRow –
- type LowerRow
int
- param UpperRow
- type UpperRow
int
- param LowerCol
- type LowerCol
int
- param UpperCol
- type UpperCol
int
- rtype
None:param Tab:
- type Tab
Standard_Address
- param LowerRow
- type LowerRow
int
- param UpperRow
- type UpperRow
int
- param LowerCol
- type LowerCol
int
- param UpperCol
- type UpperCol
int
- rtype
None:param Other:
- type Other
math_DoubleTab
- rtype
None
-
Copy
()¶ - Parameters
Other –
- type Other
math_DoubleTab
- rtype
None
-
GetValue
(math_DoubleTab self, Standard_Integer const RowIndex, Standard_Integer const ColIndex) → Standard_Real¶
-
Init
()¶ - Parameters
InitValue –
- type InitValue
float
- rtype
None
-
SetLowerCol
()¶ - Parameters
LowerCol –
- type LowerCol
int
- rtype
None
-
SetLowerRow
()¶ - Parameters
LowerRow –
- type LowerRow
int
- rtype
None
-
SetValue
(math_DoubleTab self, Standard_Integer const RowIndex, Standard_Integer const ColIndex, Standard_Real value)¶
-
property
thisown
¶ The membership flag
-
class
math_EigenValuesSearcher
(*args)¶ Bases:
object
- Parameters
Diagonal –
- type Diagonal
TColStd_Array1OfReal
- param Subdiagonal
- type Subdiagonal
TColStd_Array1OfReal
- rtype
None
-
Dimension
()¶ - Returns the dimension of matrix
- rtype
int
-
EigenValue
()¶ - Returns the Index_th eigen value of matrix Index must be in [1, Dimension()]
- param Index
- type Index
int
- rtype
float
-
EigenVector
()¶ - Returns the Index_th eigen vector of matrix Index must be in [1, Dimension()]
- param Index
- type Index
int
- rtype
math_Vector
-
IsDone
()¶ - Returns Standard_True if computation is performed successfully.
- rtype
bool
-
property
thisown
¶ The membership flag
-
class
math_FRPR
(*args)¶ Bases:
object
- Initializes the computation of the minimum of F. Warning: constructor does not perform computations.
- param theFunction
- type theFunction
math_MultipleVarFunctionWithGradient
- param theTolerance
- type theTolerance
float
- param theNbIterations
default value is 200
- type theNbIterations
int
- param theZEPS
default value is 1.0e-12
- type theZEPS
float
- rtype
None
-
DumpToString
(math_FRPR self) → std::string¶
-
Gradient
()¶ - returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- param Grad
- type Grad
math_Vector
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param theFunction
- type theFunction
math_MultipleVarFunctionWithGradient
- rtype
bool
-
Location
()¶ - returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- param Loc
- type Loc
math_Vector
- rtype
None
-
Minimum
()¶ - returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- rtype
int
-
Perform
()¶ - The solution F = Fi is found when 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS).
- param theFunction
- type theFunction
math_MultipleVarFunctionWithGradient
- param theStartingPoint
- type theStartingPoint
math_Vector
- rtype
None
-
property
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.
- rtype
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.
- param X
- type X
float
- param F
- type F
float
- rtype
bool
-
property
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.
- param F
- type F
math_FunctionWithDerivative
- param S
- type S
math_FunctionSample
- param EpsX
- type EpsX
float
- param EpsF
- type EpsF
float
- param EpsNul
- type EpsNul
float
- rtype
None
-
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.
- param Index
- type Index
int
- param A
- type A
float
- param B
- type B
float
- rtype
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.
- param Index
- type Index
int
- param IFirst
- type IFirst
int
- param ILast
- type ILast
int
- rtype
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.
- param Index
- type Index
int
- rtype
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.
- param Index
- type Index
int
- rtype
int
-
IsDone
()¶ - Returns True if the computation has been done successfully.
- rtype
bool
-
NbIntervals
()¶ - Returns the number of intervals on which the function is Null. An exception is raised if IsDone returns False.
- rtype
int
-
NbPoints
()¶ - returns the number of points where the function is Null. An exception is raised if IsDone returns False.
- rtype
int
-
property
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.
- param F
- type F
math_FunctionWithDerivative
- param Guess
- type Guess
float
- param Tolerance
- type Tolerance
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
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.
- param F
- type F
math_FunctionWithDerivative
- param Guess
- type Guess
float
- param Tolerance
- type Tolerance
float
- param A
- type A
float
- param B
- type B
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
None
-
Derivative
()¶ - returns the value of the derivative at the root. Exception NotDone is raised if the root was not found.
- rtype
float
-
DumpToString
(math_FunctionRoot self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- rtype
int
-
Root
()¶ - returns the value of the root. Exception NotDone is raised if the root was not found.
- rtype
float
-
Value
()¶ - returns the value of the function at the root. Exception NotDone is raised if the root was not found.
- rtype
float
-
property
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.
- param F
- type F
math_FunctionWithDerivative
- param A
- type A
float
- param B
- type B
float
- param NbSample
- type NbSample
int
- param EpsX
default value is 0.0
- type EpsX
float
- param EpsF
default value is 0.0
- type EpsF
float
- param EpsNull
default value is 0.0
- type EpsNull
float
- param K
default value is 0.0
- type K
float
- rtype
None
-
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).
- rtype
bool
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
bool
-
NbSolutions
()¶ - Returns the number of solutions found. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
- rtype
int
-
StateNumber
()¶ - returns the StateNumber of the Nieme root. Exception RangeError is raised if Nieme is < 1 or Nieme > NbSolutions.
- param Nieme
- type Nieme
int
- rtype
int
-
Value
()¶ - Returns the Nth value of the root of function F. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
- param Nieme
- type Nieme
int
- rtype
float
-
property
thisown
¶ The membership flag
-
class
math_FunctionSample
(*args)¶ Bases:
object
- Parameters
A –
- type A
float
- param B
- type B
float
- param N
- type N
int
- rtype
None
-
Bounds
()¶ - Returns the bounds of parameters.
- param A
- type A
float
- param B
- type B
float
- rtype
void
-
GetParameter
()¶ - Returns the value of parameter of the point of range IndexA + ((Index-1)/(NbPoints-1))*B. An exception is raised if Index<=0 or Index>NbPoints.
- param Index
- type Index
int
- rtype
float
-
NbPoints
()¶ - Returns the number of sample points.
- rtype
int
-
property
thisown
¶ The membership flag
-
class
math_FunctionSet
(*args, **kwargs)¶ Bases:
object
-
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.
- rtype
int
-
NbEquations
()¶ - Returns the number of equations of the function.
- rtype
int
-
NbVariables
()¶ - Returns the number of variables of the function.
- rtype
int
-
Value
()¶ - Computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.
- param X
- type X
math_Vector
- param F
- type F
math_Vector
- rtype
bool
-
property
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.
- param F
- type F
math_FunctionSetWithDerivatives
- param Tolerance
- type Tolerance
math_Vector
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
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.
- param F
- type F
math_FunctionSetWithDerivatives
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
None
-
Derivative
()¶ - Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.
- rtype
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.
- param Der
- type Der
math_Matrix
- rtype
None
-
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.
- rtype
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.
- param Err
- type Err
math_Vector
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param F
- type F
math_FunctionSetWithDerivatives
- rtype
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.
- rtype
int
-
Perform
()¶ - Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1)(j) <= Tolerance(j) for all unknowns.
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theStartingPoint
- type theStartingPoint
math_Vector
- param theStopOnDivergent
default value is Standard_False
- type theStopOnDivergent
bool
- rtype
None* Improves the root of function from the initial guess point. The infinum and supremum may be given to constrain the solution. In this case, the solution is found when: abs(Xi - Xi-1) <= Tolerance for all unknowns.
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theStartingPoint
- type theStartingPoint
math_Vector
- param theInfBound
- type theInfBound
math_Vector
- param theSupBound
- type theSupBound
math_Vector
- param theStopOnDivergent
default value is Standard_False
- type theStopOnDivergent
bool
- rtype
None
-
Root
()¶ - Returns the value of the root of function F. Exception NotDone is raised if the root was not found.
- rtype
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.
- param Root
- type Root
math_Vector
- rtype
None
-
SetTolerance
()¶ - Initializes the tolerance values.
- param Tolerance
- type Tolerance
math_Vector
- rtype
None
-
StateNumber
()¶ - returns the stateNumber (as returned by F.GetStateNumber()) associated to the root found.
- rtype
int
-
property
thisown
¶ The membership flag
-
class
math_FunctionSetWithDerivatives
(*args, **kwargs)¶ Bases:
OCC.Core.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.
- param X
- type X
math_Vector
- param D
- type D
math_Matrix
- rtype
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.
- param X
- type X
math_Vector
- param F
- type F
math_Vector
- param D
- type D
math_Matrix
- rtype
bool
-
property
thisown
¶ The membership flag
-
-
class
math_FunctionWithDerivative
(*args, **kwargs)¶ Bases:
OCC.Core.math.math_Function
-
Derivative
()¶ - Computes the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.
- param X
- type X
float
- param D
- type D
float
- rtype
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.
- param X
- type X
float
- param F
- type F
float
- param D
- type D
float
- rtype
bool
-
property
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.
- param A
- type A
math_Matrix
- param MinPivot
default value is 1.0e-20
- type MinPivot
float
- param aProgress
default value is opencascade::handle<Message_ProgressIndicator>()
- type aProgress
Message_ProgressIndicator
- rtype
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.
- rtype
float
-
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.
- param Inv
- type Inv
math_Matrix
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false
- rtype
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.
- param B
- type B
math_Vector
- param X
- type X
math_Vector
- rtype
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.
- param B
- type B
math_Vector
- rtype
None
-
property
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.
- param A
- type A
math_Matrix
- param MinPivot
default value is 1.0e-20
- type MinPivot
float
- rtype
None
-
DumpToString
(math_GaussLeastSquare self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.e
- rtype
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.
- param B
- type B
math_Vector
- param X
- type X
math_Vector
- rtype
None
-
property
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.
- param F
- type F
math_MultipleVarFunction
- param Lower
- type Lower
math_Vector
- param Upper
- type Upper
math_Vector
- param Order
- type Order
math_IntegerVector
- rtype
None
-
DumpToString
(math_GaussMultipleIntegration self) → std::string¶
-
IsDone
()¶ - returns True if all has been correctly done.
- rtype
bool
-
Value
()¶ - returns the value of the integral.
- rtype
float
-
property
thisown
¶ The membership flag
-
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.
- param F
- type F
math_FunctionSet
- param Lower
- type Lower
math_Vector
- param Upper
- type Upper
math_Vector
- param Order
- type Order
math_IntegerVector
- rtype
None
-
DumpToString
(math_GaussSetIntegration self) → std::string¶
-
IsDone
()¶ - returns True if all has been correctly done.
- rtype
bool
-
Value
()¶ - returns the value of the integral.
- rtype
math_Vector
-
property
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. :param F: :type F: math_Function :param Lower: :type Lower: float :param Upper: :type Upper: float :param Order: :type Order: int :rtype: 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. :param F: :type F: math_Function :param Lower: :type Lower: float :param Upper: :type Upper: float :param Order: :type Order: int :param Tol: :type Tol: float :rtype: None
-
DumpToString
(math_GaussSingleIntegration self) → std::string¶
-
IsDone
()¶ - returns True if all has been correctly done.
- rtype
bool
-
Value
()¶ - returns the value of the integral.
- rtype
float
-
property
thisown
¶ The membership flag
-
class
math_GlobOptMin
(*args)¶ Bases:
object
- Constructor. Perform method is not called from it. @param theFunc - objective functional. @param theLowerBorder - lower corner of the search box. @param theUpperBorder - upper corner of the search box. @param theC - Lipschitz constant. @param theDiscretizationTol - parameter space discretization tolerance. @param theSameTol - functional value space indifference tolerance.
- param theFunc
- type theFunc
math_MultipleVarFunction *
- param theLowerBorder
- type theLowerBorder
math_Vector
- param theUpperBorder
- type theUpperBorder
math_Vector
- param theC
default value is 9
- type theC
float
- param theDiscretizationTol
default value is 1.0e-2
- type theDiscretizationTol
float
- param theSameTol
default value is 1.0e-7
- type theSameTol
float
- rtype
None
-
GetContinuity
()¶ - Return type
inline int
-
GetF
()¶ - Get best functional value.
- rtype
inline float
-
GetFunctionalMinimalValue
()¶ - Return type
inline float
-
GetLipConstState
()¶ - Return type
inline bool
-
GetTol
()¶ - Method to get tolerances. @param theDiscretizationTol - parameter space discretization tolerance. @param theSameTol - functional value space indifference tolerance.
- param theDiscretizationTol
- type theDiscretizationTol
float
- param theSameTol
- type theSameTol
float
- rtype
None
-
NbExtrema
()¶ - Return count of global extremas.
- rtype
inline int
-
Perform
()¶ - @param isFindSingleSolution - defines whether to find single solution or all solutions.
- param isFindSingleSolution
default value is Standard_False
- type isFindSingleSolution
bool
- rtype
None
-
Points
()¶ - Return solution theIndex, 1 <= theIndex <= NbExtrema.
- param theIndex
- type theIndex
int
- param theSol
- type theSol
math_Vector
- rtype
None
-
SetContinuity
()¶ - Set / Get continuity of local borders splits (0 ~ C0, 1 ~ C1, 2 ~ C2).
- param theCont
- type theCont
int
- rtype
inline void
-
SetFunctionalMinimalValue
()¶ - Set / Get functional minimal value.
- param theMinimalValue
- type theMinimalValue
float
- rtype
inline void
-
SetGlobalParams
()¶ - @param theFunc - objective functional. @param theLowerBorder - lower corner of the search box. @param theUpperBorder - upper corner of the search box. @param theC - Lipschitz constant. @param theDiscretizationTol - parameter space discretization tolerance. @param theSameTol - functional value space indifference tolerance.
- param theFunc
- type theFunc
math_MultipleVarFunction *
- param theLowerBorder
- type theLowerBorder
math_Vector
- param theUpperBorder
- type theUpperBorder
math_Vector
- param theC
default value is 9
- type theC
float
- param theDiscretizationTol
default value is 1.0e-2
- type theDiscretizationTol
float
- param theSameTol
default value is 1.0e-7
- type theSameTol
float
- rtype
None
-
SetLipConstState
()¶ - Set / Get Lipchitz constant modification state. True means that the constant is locked and unlocked otherwise.
- param theFlag
- type theFlag
bool
- rtype
inline void
-
SetLocalParams
()¶ - Method to reduce bounding box. Perform will use this box. @param theLocalA - lower corner of the local box. @param theLocalB - upper corner of the local box.
- param theLocalA
- type theLocalA
math_Vector
- param theLocalB
- type theLocalB
math_Vector
- rtype
None
-
SetTol
()¶ - Method to set tolerances. @param theDiscretizationTol - parameter space discretization tolerance. @param theSameTol - functional value space indifference tolerance.
- param theDiscretizationTol
- type theDiscretizationTol
float
- param theSameTol
- type theSameTol
float
- rtype
None
-
property
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.
- param A
- type A
math_Matrix
- param B
- type B
math_Matrix
- param EPS
default value is 1.0e-20
- type EPS
float
- rtype
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.
- param A
- type A
math_Matrix
- param B
- type B
math_Matrix
- param lowerArow
- type lowerArow
int
- param upperArow
- type upperArow
int
- param lowerAcol
- type lowerAcol
int
- param upperAcol
- type upperAcol
int
- param EPS
default value is 1.0e-20
- type EPS
float
- rtype
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.
- param A
- type A
math_Matrix
- param B
- type B
math_Vector
- param EPS
default value is 1.0e-20
- type EPS
float
- rtype
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.
- rtype
math_Matrix
-
DumpToString
(math_Householder self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param sol
- type sol
math_Vector
- param Index
default value is 1
- type Index
int
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_IntegerVector
(*args)¶ Bases:
object
- contructs an IntegerVector in the range [Lower..Upper]
- param theFirst
- type theFirst
int
- param theLast
- type theLast
int
- rtype
None* contructs an IntegerVector in the range [Lower..Upper] with all the elements set to theInitialValue.
- param theFirst
- type theFirst
int
- param theLast
- type theLast
int
- param theInitialValue
- type theInitialValue
int
- rtype
None* constructs an IntegerVector in the range [Lower..Upper] which share the ‘c array’ theTab.
- param theTab
- type theTab
int *
- param theFirst
- type theFirst
int
- param theLast
- type theLast
int
- rtype
None* constructs a copy for initialization. An exception is raised if the lengths of the IntegerVectors are different.
- param theOther
- type theOther
math_IntegerVector
- rtype
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.
- param theRight
- type theRight
math_IntegerVector
- rtype
None* sets an IntegerVector to the sum of the IntegerVector ‘theLeft’ and the IntegerVector ‘theRight’. An exception is raised if the lengths are different.
- param theLeft
- type theLeft
math_IntegerVector
- param theRight
- type theRight
math_IntegerVector
- rtype
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.
- param theRight
- type theRight
math_IntegerVector
- rtype
math_IntegerVector
-
DumpToString
(math_IntegerVector self) → std::string¶
-
Init
()¶ - Initialize an IntegerVector with all the elements set to theInitialValue.
- param theInitialValue
- type theInitialValue
int
- rtype
None
-
Initialized
()¶ - Initialises an IntegerVector by copying ‘theOther’. An exception is raised if the Lengths are different.
- param theOther
- type theOther
math_IntegerVector
- rtype
math_IntegerVector
-
Inverse
()¶ - returns the inverse IntegerVector of an IntegerVector.
- rtype
math_IntegerVector
-
Invert
()¶ - inverses an IntegerVector.
- rtype
None
-
Length
()¶ - returns the length of an IntegerVector
- rtype
inline int
-
Lower
()¶ - returns the value of the Lower index of an IntegerVector.
- rtype
inline int
-
Max
()¶ - returns the value of the Index of the maximum element of an IntegerVector.
- rtype
int
-
Min
()¶ - returns the value of the Index of the minimum element of an IntegerVector.
- rtype
int
-
Multiplied
()¶ - returns the product of an IntegerVector by an integer value.
- param theRight
- type theRight
int
- rtype
math_IntegerVector* returns the inner product of 2 IntegerVectors. An exception is raised if the lengths are not equal.
- param theRight
- type theRight
math_IntegerVector
- rtype
int
-
Multiply
()¶ - returns the product of an IntegerVector by an integer value.
- param theRight
- type theRight
int
- rtype
None* returns the multiplication of an integer by an IntegerVector.
- param theLeft
- type theLeft
int
- param theRight
- type theRight
math_IntegerVector
- rtype
None
-
Norm
()¶ - returns the value of the norm of an IntegerVector.
- rtype
float
-
Norm2
()¶ - returns the value of the square of the norm of an IntegerVector.
- rtype
float
-
Opposite
()¶ - returns the opposite of an IntegerVector.
- rtype
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’.
- param theI1
- type theI1
int
- param theI2
- type theI2
int
- param theV
- type theV
math_IntegerVector
- rtype
None:param theOther:
- type theOther
math_IntegerVector
- rtype
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’.
- param theI1
- type theI1
int
- param theI2
- type theI2
int
- rtype
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.
- param theLeft
- type theLeft
math_IntegerVector
- param theRight
- type theRight
math_IntegerVector
- rtype
None* returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the IntegerVectors have not the same length.
- param theRight
- type theRight
math_IntegerVector
- rtype
None
-
Subtracted
()¶ - returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the IntegerVectors have not the same length.
- param theRight
- type theRight
math_IntegerVector
- rtype
math_IntegerVector
-
TMultiplied
()¶ - returns the product of a vector and a real value.
- param theRight
- type theRight
int
- rtype
math_IntegerVector
-
Upper
()¶ - returns the value of the Upper index of an IntegerVector.
- rtype
inline int
-
Value
()¶ - accesses the value of index theNum of an IntegerVector.
- param theNum
- type theNum
int
- rtype
int
-
property
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.
- param A
- type A
math_Matrix
- rtype
None
-
DumpToString
(math_Jacobi self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
bool
-
Value
()¶ - returns the eigenvalue number Num. Eigenvalues are in the range (1..n). Exception NotDone is raised if calculation is not done successfully.
- param Num
- type Num
int
- rtype
float
-
Values
()¶ - Returns the eigenvalues vector. Exception NotDone is raised if calculation is not done successfully.
- rtype
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.
- param Num
- type Num
int
- param V
- type V
math_Vector
- rtype
None
-
Vectors
()¶ - returns the eigenvectors matrix. Exception NotDone is raised if calculation is not done successfully.
- rtype
math_Matrix
-
property
thisown
¶ The membership flag
-
class
math_KronrodSingleIntegration
(*args)¶ Bases:
object
- An empty constructor.
- rtype
None* Constructor. Takes the function, the lower and upper bound values, the initial number of Kronrod points
- param theFunction
- type theFunction
math_Function
- param theLower
- type theLower
float
- param theUpper
- type theUpper
float
- param theNbPnts
- type theNbPnts
int
- rtype
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.
- param theFunction
- type theFunction
math_Function
- param theLower
- type theLower
float
- param theUpper
- type theUpper
float
- param theNbPnts
- type theNbPnts
int
- param theTolerance
- type theTolerance
float
- param theMaxNbIter
- type theMaxNbIter
int
- rtype
None
-
AbsolutError
()¶ - Returns the value of the relative error reached.
- rtype
float
-
ErrorReached
()¶ - Returns the value of the relative error reached.
- rtype
float
-
static
GKRule
()¶ - Parameters
theFunction –
- type theFunction
math_Function
- param theLower
- type theLower
float
- param theUpper
- type theUpper
float
- param theGaussP
- type theGaussP
math_Vector
- param theGaussW
- type theGaussW
math_Vector
- param theKronrodP
- type theKronrodP
math_Vector
- param theKronrodW
- type theKronrodW
math_Vector
- param theValue
- type theValue
float
- param theError
- type theError
float
- rtype
bool
-
IsDone
()¶ - Returns Standard_True if computation is performed successfully.
- rtype
bool
-
NbIterReached
()¶ - Returns the number of iterations that were made to compute result.
- rtype
int
-
OrderReached
()¶ - Returns the number of Kronrod points for which the result is computed.
- rtype
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.
- param theFunction
- type theFunction
math_Function
- param theLower
- type theLower
float
- param theUpper
- type theUpper
float
- param theNbPnts
- type theNbPnts
int
- rtype
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.
- param theFunction
- type theFunction
math_Function
- param theLower
- type theLower
float
- param theUpper
- type theUpper
float
- param theNbPnts
- type theNbPnts
int
- param theTolerance
- type theTolerance
float
- param theMaxNbIter
- type theMaxNbIter
int
- rtype
None
-
Value
()¶ - Returns the value of the integral.
- rtype
float
-
property
thisown
¶ The membership flag
-
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.
- param LowerRow
- type LowerRow
int
- param UpperRow
- type UpperRow
int
- param LowerCol
- type LowerCol
int
- param UpperCol
- type UpperCol
int
- rtype
None* constructs a non-initialized matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] whose values are all initialized with the value InitialValue.
- param LowerRow
- type LowerRow
int
- param UpperRow
- type UpperRow
int
- param LowerCol
- type LowerCol
int
- param UpperCol
- type UpperCol
int
- param InitialValue
- type InitialValue
float
- rtype
None* constructs a matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] Sharing data with a ‘C array’ pointed by Tab.
- param Tab
- type Tab
Standard_Address
- param LowerRow
- type LowerRow
int
- param UpperRow
- type UpperRow
int
- param LowerCol
- type LowerCol
int
- param UpperCol
- type UpperCol
int
- rtype
None* constructs a matrix for copy in initialization. An exception is raised if the matrixes have not the same dimensions.
- param Other
- type Other
math_Matrix
- rtype
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.
- param Right
- type Right
math_Matrix
- rtype
None* sets a matrix to the addition of <Left> and <Right>. An exception is raised if the dimensions are different.
- param Left
- type Left
math_Matrix
- param Right
- type Right
math_Matrix
- rtype
None
-
Added
()¶ - adds the matrix <Right> to a matrix. An exception is raised if the dimensions are different.
- param Right
- type Right
math_Matrix
- rtype
math_Matrix
-
Col
()¶ - Returns the column of index <Col> of a matrix.
- param Col
- type Col
int
- rtype
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.
- rtype
int
-
Determinant
()¶ - Computes the determinant of a matrix. An exception is raised if the matrix is not a square matrix.
- rtype
float
-
Divide
()¶ - divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.
- param Right
- type Right
float
- rtype
None
-
Divided
()¶ - divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.
- param Right
- type Right
float
- rtype
math_Matrix
-
DumpToString
(math_Matrix self) → std::string¶
-
GetValue
(math_Matrix self, Standard_Integer const Row, Standard_Integer const Col) → Standard_Real¶
-
Init
()¶ - Initialize all the elements of a matrix to InitialValue.
- param InitialValue
- type InitialValue
float
- rtype
None
-
Initialized
()¶ - Matrixes are copied through assignement. An exception is raised if the dimensions are differents.
- param Other
- type Other
math_Matrix
- rtype
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.
- rtype
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.
- rtype
None
-
LowerCol
()¶ - Returns the value of the Lower index of the column range of a matrix.
- rtype
int
-
LowerRow
()¶ - Returns the value of the Lower index of the row range of a matrix.
- rtype
int
-
Multiplied
()¶ - multiplies all the elements of a matrix by the value <Right>.
- param Right
- type Right
float
- rtype
math_Matrix* Returns the product of 2 matrices. An exception is raised if the dimensions are different.
- param Right
- type Right
math_Matrix
- rtype
math_Matrix* Returns the product of a matrix by a vector. An exception is raised if the dimensions are different.
- param Right
- type Right
math_Vector
- rtype
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.
- param Right
- type Right
float
- rtype
None* Computes a matrix as the product of 2 vectors. An exception is raised if the dimensions are different. <self> = <Left> * <Right>.
- param Left
- type Left
math_Vector
- param Right
- type Right
math_Vector
- rtype
None* Computes a matrix as the product of 2 matrixes. An exception is raised if the dimensions are different.
- param Left
- type Left
math_Matrix
- param Right
- type Right
math_Matrix
- rtype
None* Returns the product of 2 matrices. An exception is raised if the dimensions are different.
- param Right
- type Right
math_Matrix
- rtype
None
-
Opposite
()¶ - Returns the opposite of a matrix. An exception is raised if the dimensions are different.
- rtype
math_Matrix
-
Row
()¶ - Returns the row of index Row of a matrix.
- param Row
- type Row
int
- rtype
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.
- rtype
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.
- param I1
- type I1
int
- param I2
- type I2
int
- param J1
- type J1
int
- param J2
- type J2
int
- param M
- type M
math_Matrix
- rtype
None:param Other:
- type Other
math_Matrix
- rtype
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.
- param Col
- type Col
int
- param V
- type V
math_Vector
- rtype
None
-
SetDiag
()¶ - Sets the diagonal of a matrix to the value <Value>. An exception is raised if the matrix is not square.
- param Value
- type Value
float
- rtype
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.
- param Row
- type Row
int
- param V
- type V
math_Vector
- rtype
None
-
SetValue
(math_Matrix self, Standard_Integer const Row, Standard_Integer const Col, Standard_Real value)¶
-
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.
- param Right
- type Right
math_Matrix
- rtype
None* Sets a matrix to the Subtraction of the matrix <Right> from the matrix <Left>. An exception is raised if the dimensions are different.
- param Left
- type Left
math_Matrix
- param Right
- type Right
math_Matrix
- rtype
None
-
Subtracted
()¶ - Returns the result of the subtraction of <Right> from <self>. An exception is raised if the dimensions are different.
- param Right
- type Right
math_Matrix
- rtype
math_Matrix
-
SwapCol
()¶ - Swaps the columns of index <Col1> and <Col2>. An exception is raised if <Col1> or <Col2> is out of range.
- param Col1
- type Col1
int
- param Col2
- type Col2
int
- rtype
None
-
SwapRow
()¶ - Swaps the rows of index Row1 and Row2. An exception is raised if <Row1> or <Row2> is out of range.
- param Row1
- type Row1
int
- param Row2
- type Row2
int
- rtype
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.
- param Right
- type Right
float
- rtype
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.
- param Right
- type Right
math_Matrix
- rtype
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.
- param TLeft
- type TLeft
math_Matrix
- param Right
- type Right
math_Matrix
- rtype
None
-
Transpose
()¶ - Transposes a given matrix. An exception is raised if the matrix is not a square matrix.
- rtype
None
-
Transposed
()¶ - Teturns the transposed of a matrix. An exception is raised if the matrix is not a square matrix.
- rtype
math_Matrix
-
UpperCol
()¶ - Returns the value of the upper index of the column range of a matrix.
- rtype
int
-
UpperRow
()¶ - Returns the Upper index of the row range of a matrix.
- rtype
int
-
property
thisown
¶ The membership flag
-
class
math_MultipleVarFunction
(*args, **kwargs)¶ Bases:
object
-
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.
- rtype
int
-
NbVariables
()¶ - Returns the number of variables of the function
- rtype
int
-
Value
()¶ - Computes the values of the Functions <F> for the variable <X>. returns True if the computation was done successfully, otherwise false.
- param X
- type X
math_Vector
- param F
- type F
float
- rtype
bool
-
property
thisown
¶ The membership flag
-
-
class
math_MultipleVarFunctionWithGradient
(*args, **kwargs)¶ Bases:
OCC.Core.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.
- param X
- type X
math_Vector
- param G
- type G
math_Vector
- rtype
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.
- param X
- type X
math_Vector
- param F
- type F
float
- param G
- type G
math_Vector
- rtype
bool
-
property
thisown
¶ The membership flag
-
-
class
math_MultipleVarFunctionWithHessian
(*args, **kwargs)¶ Bases:
OCC.Core.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.
- param X
- type X
math_Vector
- param F
- type F
float
- param G
- type G
math_Vector
- rtype
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.
- param X
- type X
math_Vector
- param F
- type F
float
- param G
- type G
math_Vector
- param H
- type H
math_Matrix
- rtype
bool
-
property
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 whenabs(Xi - Xi-1) <= EpsX and abs(F(Xi))<= EpsF The maximum number of iterations allowed is given by NbIterations.
- param F
- type F
math_FunctionWithDerivative
- param Guess
- type Guess
float
- param EpsX
- type EpsX
float
- param EpsF
- type EpsF
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
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.
- param F
- type F
math_FunctionWithDerivative
- param Guess
- type Guess
float
- param EpsX
- type EpsX
float
- param EpsF
- type EpsF
float
- param A
- type A
float
- param B
- type B
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
None* is used in a sub-class to initialize correctly all the fields of this class.
- param A
- type A
float
- param B
- type B
float
- param EpsX
- type EpsX
float
- param EpsF
- type EpsF
float
- param NbIterations
default value is 100
- type NbIterations
int
- rtype
None
-
Derivative
()¶ - returns the value of the derivative at the root. Exception NotDone is raised if the root was not found.
- rtype
float
-
DumpToString
(math_NewtonFunctionRoot self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- rtype
int
-
Perform
()¶ - is used internally by the constructors.
- param F
- type F
math_FunctionWithDerivative
- param Guess
- type Guess
float
- rtype
None
-
Root
()¶ - Returns the value of the root of function <F>. Exception NotDone is raised if the root was not found.
- rtype
float
-
Value
()¶ - returns the value of the function at the root. Exception NotDone is raised if the root was not found.
- rtype
float
-
property
thisown
¶ The membership flag
-
class
math_NewtonFunctionSetRoot
(*args)¶ Bases:
object
- Initialize correctly all the fields of this class. The range (1, F.NbVariables()) must be especially respected for all vectors and matrix declarations.
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theXTolerance
- type theXTolerance
math_Vector
- param theFTolerance
- type theFTolerance
float
- param tehNbIterations
default value is 100
- type tehNbIterations
int
- rtype
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.
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theFTolerance
- type theFTolerance
float
- param theNbIterations
default value is 100
- type theNbIterations
int
- rtype
None
-
Derivative
()¶ - Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.
- rtype
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.
- param Der
- type Der
math_Matrix
- rtype
None
-
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.
- rtype
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.
- param Err
- type Err
math_Vector
- rtype
None
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param F
- type F
math_FunctionSetWithDerivatives
- rtype
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.
- rtype
int
-
Perform
()¶ - The Newton method is done to improve the root of the function from the initial guess point. The solution is found when: abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theStartingPoint
- type theStartingPoint
math_Vector
- rtype
None* The Newton method is done to improve the root of the function from the initial guess point. Bounds may be given, to constrain the solution. The solution is found when: abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i;
- param theFunction
- type theFunction
math_FunctionSetWithDerivatives
- param theStartingPoint
- type theStartingPoint
math_Vector
- param theInfBound
- type theInfBound
math_Vector
- param theSupBound
- type theSupBound
math_Vector
- rtype
None
-
Root
()¶ - Returns the value of the root of function F. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).
- rtype
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.
- param Root
- type Root
math_Vector
- rtype
None
-
SetTolerance
()¶ - Initializes the tolerance values for the unknowns.
- param XTol
- type XTol
math_Vector
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_NewtonMinimum
(*args)¶ Bases:
object
- 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 does not perform computation.
- param theFunction
- type theFunction
math_MultipleVarFunctionWithHessian
- param theTolerance
default value is Precision::Confusion()
- type theTolerance
float
- param theNbIterations
default value is 40
- type theNbIterations
int
- param theConvexity
default value is 1.0e-6
- type theConvexity
float
- param theWithSingularity
default value is Standard_True
- type theWithSingularity
bool
- rtype
None
-
DumpToString
(math_NewtonMinimum self) → std::string¶
-
GetStatus
()¶ - Returns the Status of computation. The exception NotDone is raised if an error has occured.
- rtype
math_Status
-
Gradient
()¶ - returns the gradient vector at the minimum. Exception NotDone is raised if an error has occured.the minimum was not found.
- rtype
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.
- param Grad
- type Grad
math_Vector
- rtype
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.
- rtype
bool
-
IsDone
()¶ - Tests if an error has occured.
- rtype
bool
-
Location
()¶ - returns the location vector of the minimum. Exception NotDone is raised if an error has occured.
- rtype
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.
- param Loc
- type Loc
math_Vector
- rtype
None
-
Minimum
()¶ - returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- rtype
int
-
Perform
()¶ - Search the solution.
- param theFunction
- type theFunction
math_MultipleVarFunctionWithHessian
- param theStartingPoint
- type theStartingPoint
math_Vector
- rtype
None
-
SetBoundary
()¶ - Set boundaries.
- param theLeftBorder
- type theLeftBorder
math_Vector
- param theRightBorder
- type theRightBorder
math_Vector
- rtype
None
-
property
thisown
¶ The membership flag
-
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. */
- param theFunc
- type theFunc
math_MultipleVarFunction *
- param theLowBorder
- type theLowBorder
math_Vector
- param theUppBorder
- type theUppBorder
math_Vector
- param theSteps
- type theSteps
math_Vector
- param theNbParticles
default value is 32
- type theNbParticles
int
- param theNbIter
default value is 100
- type theNbIter
int
- rtype
None
-
Perform
()¶ - Perform computations, particles array is constructed inside of this function.
- param theSteps
- type theSteps
math_Vector
- param theValue
- type theValue
float
- param theOutPnt
- type theOutPnt
math_Vector
- param theNbIter
default value is 100
- type theNbIter
int
- rtype
None* Perform computations with given particles array.
- param theParticles
- type theParticles
math_PSOParticlesPool
- param theNbParticles
- type theNbParticles
int
- param theValue
- type theValue
float
- param theOutPnt
- type theOutPnt
math_Vector
- param theNbIter
default value is 100
- type theNbIter
int
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_PSOParticlesPool
(*args)¶ Bases:
object
- Parameters
theParticlesCount –
- type theParticlesCount
int
- param theDimensionCount
- type theDimensionCount
int
- rtype
None
-
GetBestParticle
()¶ - Return type
PSO_Particle *
-
GetParticle
()¶ - Parameters
theIdx –
- type theIdx
int
- rtype
PSO_Particle *
-
GetWorstParticle
()¶ - Return type
PSO_Particle *
-
property
thisown
¶ The membership flag
-
class
math_Powell
(*args)¶ Bases:
object
- Constructor. Initialize new entity.
- param theFunction
- type theFunction
math_MultipleVarFunction
- param theTolerance
- type theTolerance
float
- param theNbIterations
default value is 200
- type theNbIterations
int
- param theZEPS
default value is 1.0e-12
- type theZEPS
float
- rtype
None
-
DumpToString
(math_Powell self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param theFunction
- type theFunction
math_MultipleVarFunction
- rtype
bool
-
Location
()¶ - returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- param Loc
- type Loc
math_Vector
- rtype
None
-
Minimum
()¶ - Returns the value of the minimum. Exception NotDone is raised if the minimum was not found.
- rtype
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.
- rtype
int
-
Perform
()¶ - Computes Powell minimization on the function F given theStartingPoint, and an initial matrix theStartingDirection 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).
- param theFunction
- type theFunction
math_MultipleVarFunction
- param theStartingPoint
- type theStartingPoint
math_Vector
- param theStartingDirections
- type theStartingDirections
math_Matrix
- rtype
None
-
property
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.
- param A
- type A
math_Matrix
- rtype
None
-
DumpToString
(math_SVD self) → std::string¶
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- param Inv
- type Inv
math_Matrix
- param Eps
default value is 1.0e-6
- type Eps
float
- rtype
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.
- param B
- type B
math_Vector
- param X
- type X
math_Vector
- param Eps
default value is 1.0e-6
- type Eps
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
math_TrigonometricEquationFunction
(*args)¶ Bases:
OCC.Core.math.math_FunctionWithDerivative
- Parameters
A –
- type A
float
- param B
- type B
float
- param C
- type C
float
- param D
- type D
float
- param E
- type E
float
- rtype
None
-
property
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.
- param A
- type A
float
- param B
- type B
float
- param C
- type C
float
- param D
- type D
float
- param E
- type E
float
- param InfBound
- type InfBound
float
- param SupBound
- type SupBound
float
- rtype
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.
- param D
- type D
float
- param E
- type E
float
- param InfBound
- type InfBound
float
- param SupBound
- type SupBound
float
- rtype
None* Given the three coefficients c, d and e, it performs the resolution of c*Cos(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.
- param C
- type C
float
- param D
- type D
float
- param E
- type E
float
- param InfBound
- type InfBound
float
- param SupBound
- type SupBound
float
- rtype
None
-
DumpToString
(math_TrigonometricFunctionRoots self) → std::string¶
-
InfiniteRoots
()¶ - Returns true if there is an infinity of roots, otherwise returns false.
- rtype
bool
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
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.
- rtype
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.
- param Index
- type Index
int
- rtype
float
-
property
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.
- param Cont
- type Cont
math_Matrix
- param Secont
- type Secont
math_Vector
- param StartingPoint
- type StartingPoint
math_Vector
- param EpsLix
default value is 1.0e-06
- type EpsLix
float
- param EpsLic
default value is 1.0e-06
- type EpsLic
float
- param NbIterations
default value is 500
- type NbIterations
int
- rtype
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.
- param Cont
- type Cont
math_Matrix
- param Secont
- type Secont
math_Vector
- param StartingPoint
- type StartingPoint
math_Vector
- param Nci
- type Nci
int
- param Nce
- type Nce
int
- param EpsLix
default value is 1.0e-06
- type EpsLix
float
- param EpsLic
default value is 1.0e-06
- type EpsLic
float
- param NbIterations
default value is 500
- type NbIterations
int
- rtype
None
-
Duale
()¶ - returns the duale variables V of the systeme.
- param V
- type V
math_Vector
- rtype
None
-
DumpToString
(math_Uzawa self) → std::string¶
-
Error
()¶ - Returns the difference between X solution and the StartingPoint. An exception is raised if NotDone.
- rtype
math_Vector
-
InitialError
()¶ - Returns the initial error Cont*StartingPoint-Secont. An exception is raised if NotDone.
- rtype
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.
- rtype
math_Matrix
-
IsDone
()¶ - Returns true if the computations are successful, otherwise returns false.
- rtype
bool
-
NbIterations
()¶ - returns the number of iterations really done. An exception is raised if NotDone.
- rtype
int
-
Value
()¶ - Returns the vector solution of the system above. An exception is raised if NotDone.
- rtype
math_Vector
-
property
thisown
¶ The membership flag
-
class
math_ValueAndWeight
(*args)¶ Bases:
object
- Return type
None:param theValue: :type theValue: float :param theWeight: :type theWeight: float :rtype: None
-
property
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.
- param theLower
- type theLower
int
- param theUpper
- type theUpper
int
- rtype
None* Contructs a vector in the range [theLower..theUpper] whose values are all initialized with the value ‘theInitialValue’
- param theLower
- type theLower
int
- param theUpper
- type theUpper
int
- param theInitialValue
- type theInitialValue
float
- rtype
None* Constructs a vector in the range [theLower..theUpper] with the ‘c array’ theTab.
- param theTab
- type theTab
float *
- param theLower
- type theLower
int
- param theUpper
- type theUpper
int
- rtype
None* Constructor for converting gp_XY to math_Vector
- param Other
- type Other
gp_XY
- rtype
None* Constructor for converting gp_XYZ to math_Vector
- param Other
- type Other
gp_XYZ
- rtype
None* Constructs a copy for initialization. An exception is raised if the lengths of the vectors are different.
- param theOther
- type theOther
math_Vector
- rtype
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.
- param theRight
- type theRight
math_Vector
- rtype
None* sets a vector to the sum of the vector ‘theLeft’ and the vector ‘theRight’. An exception is raised if the lengths are different.
- param theLeft
- type theLeft
math_Vector
- param theRight
- type theRight
math_Vector
- rtype
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.
- param theRight
- type theRight
math_Vector
- rtype
math_Vector
-
Divide
()¶ - divides a vector by the value ‘theRight’. An exception is raised if ‘theRight’ = 0.
- param theRight
- type theRight
float
- rtype
None
-
Divided
()¶ - divides a vector by the value ‘theRight’. An exception is raised if ‘theRight’ = 0.
- param theRight
- type theRight
float
- rtype
math_Vector
-
DumpToString
(math_Vector self) → std::string¶
-
Init
()¶ - Initialize all the elements of a vector with ‘theInitialValue’.
- param theInitialValue
- type theInitialValue
float
- rtype
None
-
Initialized
()¶ - Initialises a vector by copying ‘theOther’. An exception is raised if the Lengths are differents.
- param theOther
- type theOther
math_Vector
- rtype
math_Vector
-
Inverse
()¶ - Inverts this vector and creates a new vector.
- rtype
math_Vector
-
Invert
()¶ - Inverts this vector and assigns the result to this vector.
- rtype
None
-
Length
()¶ - Returns the length of a vector
- rtype
inline int
-
Lower
()¶ - Returns the value of the theLower index of a vector.
- rtype
inline int
-
Max
()¶ - Returns the value of the ‘Index’ of the maximum element of a vector.
- rtype
int
-
Min
()¶ - Returns the value of the ‘Index’ of the minimum element of a vector.
- rtype
int
-
Multiplied
()¶ - returns the product of a vector and a real value.
- param theRight
- type theRight
float
- rtype
math_Vector* returns the inner product of 2 vectors. An exception is raised if the lengths are not equal.
- param theRight
- type theRight
math_Vector
- rtype
float* returns the product of a vector by a matrix.
- param theRight
- type theRight
math_Matrix
- rtype
math_Vector
-
Multiply
()¶ - returns the product of a vector and a real value.
- param theRight
- type theRight
float
- rtype
None* sets a vector to the product of the vector ‘theLeft’ with the matrix ‘theRight’.
- param theLeft
- type theLeft
math_Vector
- param theRight
- type theRight
math_Matrix
- rtype
None* //!sets a vector to the product of the matrix ‘theLeft’ with the vector ‘theRight’.
- param theLeft
- type theLeft
math_Matrix
- param theRight
- type theRight
math_Vector
- rtype
None* returns the multiplication of a real by a vector. ‘me’ = ‘theLeft’ * ‘theRight’
- param theLeft
- type theLeft
float
- param theRight
- type theRight
math_Vector
- rtype
None
-
Norm
()¶ - Returns the value or the square of the norm of this vector.
- rtype
float
-
Norm2
()¶ - Returns the value of the square of the norm of a vector.
- rtype
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().
- rtype
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().
- rtype
math_Vector
-
Opposite
()¶ - returns the opposite of a vector.
- rtype
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’.
- param theI1
- type theI1
int
- param theI2
- type theI2
int
- param theV
- type theV
math_Vector
- rtype
None:param theOther:
- type theOther
math_Vector
- rtype
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.)
- param theI1
- type theI1
int
- param theI2
- type theI2
int
- rtype
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.
- param theLeft
- type theLeft
math_Vector
- param theRight
- type theRight
math_Vector
- rtype
None* returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the vectors have not the same length.
- param theRight
- type theRight
math_Vector
- rtype
None
-
Subtracted
()¶ - returns the subtraction of ‘theRight’ from ‘me’. An exception is raised if the vectors have not the same length.
- param theRight
- type theRight
math_Vector
- rtype
math_Vector
-
TMultiplied
()¶ - returns the product of a vector and a real value.
- param theRight
- type theRight
float
- rtype
math_Vector
-
TMultiply
()¶ - sets a vector to the product of the transpose of the matrix ‘theTLeft’ by the vector ‘theRight’.
- param theTLeft
- type theTLeft
math_Matrix
- param theRight
- type theRight
math_Vector
- rtype
None* sets a vector to the product of the vector ‘theLeft’ by the transpose of the matrix ‘theTRight’.
- param theLeft
- type theLeft
math_Vector
- param theTRight
- type theTRight
math_Matrix
- rtype
None
-
Upper
()¶ - Returns the value of the theUpper index of a vector.
- rtype
inline int
-
Value
()¶ - accesses the value of index ‘theNum’ of a vector.
- param theNum
- type theNum
int
- rtype
float
-
property
thisown
¶ The membership flag