OpenCascade.js
API ReferenceFoundationClassesTKMath

math

OCCT package math: Handle_math_NotSquare, Handle_math_SingularMatrix, math, math_BFGS, and 46 more bound classes.

math

Constructors(1)

Static methods(6)

  • GaussPointsMax(): number
  • GaussPoints(Index: number, Points: math_Vector): void
    Parameters (2)
    • Index
    • Points
  • GaussWeights(Index: number, Weights: math_Vector): void
    Parameters (2)
    • Index
    • Weights
  • 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.

  • OrderedGaussPointsAndWeights(Index: number, Points: math_Vector, Weights: math_Vector): boolean

    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 true if Index is positive, Points' and Weights' length is equal to Index, Points and Weights are successfully computed.
    Parameters (3)
    • Index
    • Points
    • Weights
  • KronrodPointsAndWeights(Index: number, Points: math_Vector, Weights: math_Vector): boolean

    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 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 false.

    Parameters (3)
    • Index
    • Points
    • Weights

math_BFGS

This class implements the Broyden-Fletcher-Goldfarb-Shanno variant of Davidson-Fletcher-Powell minimization algorithm of a function of multiple variables.Knowledge of the function's gradient is required.
It is possible to solve conditional optimization problem on hyperparallelepiped. Method SetBoundary is used to define hyperparallelepiped borders. With boundaries defined, the algorithm will not make evaluations of the function outside of the borders.

Constructors(1)

  • constructor(NbVariables: number, Tolerance?: number, NbIterations?: number, ZEPS?: number): math_BFGS

    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.

    Parameters (4)
    • NbVariables
    • Tolerance
    • NbIterations
    • ZEPS

Instance methods(10)

  • SetBoundary(theLeftBorder: math_Vector, theRightBorder: math_Vector): void

    Set boundaries for conditional optimization. The expected indices range of vectors is [1, NbVariables].

    Parameters (2)
    • theLeftBorder
    • theRightBorder
  • Perform(F: math_MultipleVarFunctionWithGradient, StartingPoint: math_Vector): void

    Given the starting point StartingPoint, minimization is done on the function F. The solution F = Fi is found when : 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). Tolerance, ZEPS and maximum number of iterations are given in the constructor.

    Parameters (2)
    • F
    • StartingPoint
  • This method is called at the end of each iteration to check if the solution is found. It can be redefined in a sub-class to implement a specific test to stop the iterations.

    Parameters (1)
    • F
  • IsDone(): boolean

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

  • Location(): math_Vector

    returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.

  • Location(Loc: math_Vector): void

    outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.

    Parameters (1)
    • Loc
  • Minimum(): number

    returns the value of the minimum. Exception NotDone is raised if the minimum was not found.

  • Gradient(): math_Vector

    Returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.

  • Gradient(Grad: math_Vector): void

    Returns the value of the gradient vector at the minimum in Grad. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Grad is not equal to the range of the StartingPoint.

    Parameters (1)
    • Grad
  • NbIterations(): number

    Returns the number of iterations really done in the calculation of the minimum. The exception NotDone is raised if the minimum was not found.

math_BissecNewton

This class implements a combination of Newton-Raphson and bissection methods to find the root of the function between two bounds. Knowledge of the derivative is required.

Constructors(1)

Instance methods(6)

  • Perform(F: math_FunctionWithDerivative, Bound1: number, Bound2: number, NbIterations?: number): void

    A combination of Newton-Raphson and bissection methods is done to find the root of the function F between the bounds Bound1 and Bound2 on the function F. The tolerance required on the root is given by TolX. The solution is found when: abs(Xi - Xi-1) <= TolX and F(Xi) * F(Xi-1) <= 0 The maximum number of iterations allowed is given by NbIterations.

    Parameters (4)
    • F
    • Bound1
    • Bound2
    • NbIterations
  • This method is called at the end of each iteration to check if the solution has been found. It can be redefined in a sub-class to implement a specific test to stop the iterations.

    Parameters (1)
    • theFunction
  • IsDone(): boolean

    Tests is the root has been successfully found.

  • Root(): number

    returns the value of the root. Exception NotDone is raised if the minimum was not found.

  • Derivative(): number

    returns the value of the derivative at the root. Exception NotDone is raised if the minimum was not found.

  • Value(): number

    returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.

math_BracketedRoot

This class implements the Brent method to find the root of a function located within two bounds. No knowledge of the derivative is required.

Constructors(1)

  • constructor(F: math_Function, Bound1: number, Bound2: number, Tolerance: number, NbIterations?: number, ZEPS?: number): math_BracketedRoot

    The Brent method is used to find the root of the function F between the bounds Bound1 and Bound2 on the function F. If F(Bound1)*F(Bound2) >0 the Brent method fails. The tolerance required for the root is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= Tolerance; The maximum number of iterations allowed is given by NbIterations.

    Parameters (6)
    • F
    • Bound1
    • Bound2
    • Tolerance
    • NbIterations
    • ZEPS

Instance methods(4)

  • IsDone(): boolean

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

  • Root(): number

    returns the value of the root. Exception NotDone is raised if the minimum was not found.

  • Value(): number

    returns the value of the function at the root. Exception NotDone is raised if the minimum was not found.

  • NbIterations(): number

    returns the number of iterations really done during the computation of the Root. Exception NotDone is raised if the minimum was not found.

math_BracketMinimum

Given two distinct initial points, BracketMinimum implements the computation of three points (a, b, c) which bracket the minimum of the function and verify A less than B, B less than C and F(B) less than F(A), F(B) less than F(C).
The algorithm supports conditional optimization. By default no limits are applied to the parameter change. The method SetLimits defines the allowed range. 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.

Constructors(4)

  • constructor(A: number, B: number): math_BracketMinimum

    Constructor preparing A and B parameters only. It does not perform the job.

    Parameters (2)
    • A
    • B
  • constructor(F: math_Function, A: number, B: number): math_BracketMinimum

    Given two initial values this class computes a bracketing triplet of abscissae Ax, Bx, Cx (such that Bx is between Ax and Cx, F(Bx) is less than both F(Bx) and F(Cx)) the Brent minimization is done on the function F.

    Parameters (3)
    • F
    • A
    • B
  • constructor(F: math_Function, A: number, B: number, FA: number): math_BracketMinimum

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

    Parameters (4)
    • F
    • A
    • B
    • FA
  • constructor(F: math_Function, A: number, B: number, FA: number, FB: number): math_BracketMinimum

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

    Parameters (5)
    • F
    • A
    • B
    • FA
    • FB

Instance methods(7)

  • SetLimits(theLeft: number, theRight: number): void

    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.

    Parameters (2)
    • theLeft
    • theRight
  • SetFA(theValue: number): void

    Set function value at A.

    Parameters (1)
    • theValue
  • SetFB(theValue: number): void

    Set function value at B.

    Parameters (1)
    • theValue
  • The method performing the job. It is called automatically by constructors with the function.

    Parameters (1)
    • F
  • IsDone(): boolean

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

  • Values(A: number, B: number, C: number): { A: number; B: number; C: number }

    Returns the bracketed triplet of abscissae. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).

    Parameters (3)
    • A
    • B
    • C
    Returns

    A result object with fields:

    • A: updated value from the call.
    • B: updated value from the call.
    • C: updated value from the call.
  • FunctionValues(FA: number, FB: number, FC: number): { FA: number; FB: number; FC: number }

    returns the bracketed triplet function values. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).

    Parameters (3)
    • FA
    • FB
    • FC
    Returns

    A result object with fields:

    • FA: updated value from the call.
    • FB: updated value from the call.
    • FC: updated value from the call.

math_BrentMinimum

This class implements the Brent's method to find the minimum of a function of a single variable. No knowledge of the derivative is required.

Constructors(2)

  • constructor(TolX: number, NbIterations?: number, ZEPS?: number): math_BrentMinimum

    This constructor should be used in a sub-class to initialize correctly all the fields of this class.

    Parameters (3)
    • TolX
    • NbIterations
    • ZEPS
  • constructor(TolX: number, Fbx: number, NbIterations?: number, ZEPS?: number): math_BrentMinimum

    This constructor should be used in a sub-class to initialize correctly all the fields of this class. It has to be used if F(Bx) is known.

    Parameters (4)
    • TolX
    • Fbx
    • NbIterations
    • ZEPS

Instance methods(6)

  • Perform(F: math_Function, Ax: number, Bx: number, Cx: number): void

    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;.

    Parameters (4)
    • F
    • Ax
    • Bx
    • Cx
  • IsSolutionReached(theFunction: math_Function): boolean

    This method is called at the end of each iteration to check if the solution is found. It can be redefined in a sub-class to implement a specific test to stop the iterations.

    Parameters (1)
    • theFunction
  • IsDone(): boolean

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

  • Location(): number

    returns the location value of the minimum. Exception NotDone is raised if the minimum was not found.

  • Minimum(): number

    returns the value of the minimum. Exception NotDone is raised if the minimum was not found.

  • NbIterations(): number

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

math_BullardGenerator

Fast random number generator (the algorithm proposed by Ian C. Bullard).

Constructors(1)

Instance methods(3)

  • SetSeed(theSeed?: number): void

    Setup new seed / reset defaults.

    Parameters (1)
    • theSeed
  • NextInt(): number

    Generates new 64-bit integer value.

  • NextReal(): number

    Generates new floating-point value.

math_Crout

This class implements the Crout algorithm used to solve a system A*X = B where A is a symmetric matrix. It can be used to invert a symmetric matrix. This algorithm is similar to Gauss but is faster than Gauss. Only the inferior triangle of A and the diagonal can be given.

Constructors(1)

  • constructor(A: math_Matrix, MinPivot?: number): math_Crout

    Given an input matrix A, this algorithm inverts A by the Crout algorithm. The user can give only the inferior triangle for the implementation. A can be decomposed like this: A = L * D * T(L) where L is triangular inferior and D is diagonal. If one element of A is less than MinPivot, A is considered as singular. Exception NotSquare is raised if A is not a square matrix.

    Parameters (2)
    • A
    • MinPivot

Instance methods(5)

  • IsDone(): boolean

    Returns True if all has been correctly done.

  • Solve(B: math_Vector, X: math_Vector): void

    Given an input vector , this routine returns the solution of the set of linear equations A . X = B. Exception NotDone is raised if the decomposition was not done successfully. Exception DimensionError is raised if the range of B is not equal to the rowrange of A.

    Parameters (2)
    • B
    • X
  • returns the inverse matrix of A. Only the inferior triangle is returned. Exception NotDone is raised if NotDone.

  • Invert(Inv: math_Matrix): void

    returns in Inv the inverse matrix of A. Only the inferior triangle is returned. Exception NotDone is raised if NotDone.

    Parameters (1)
    • Inv
  • Determinant(): number

    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).

math_DirectPolynomialRoots

This class implements the calculation of all the real roots of a real polynomial of degree <= 4 using direct algebraic methods. The implementation uses Ferrari's method for quartics, Cardano's formula for cubics, and numerically stable algorithms for quadratics and linear equations.
Key features:

  • Robust numerical algorithms with coefficient scaling
  • Newton-Raphson root refinement for improved accuracy
  • Proper handling of degenerate and edge cases
  • Multiple root detection and infinite solution handling
  • Scientific reference ordering for deterministic results
    Once found, all roots are polished using the Newton-Raphson method to achieve maximum numerical precision.

Constructors(4)

  • constructor(theA: number, theB: number): math_DirectPolynomialRoots

    Computes the real root of the linear equation Ax + B = 0.
    Handles all cases:

    • A != 0: unique solution x = -B/A
    • A = 0, B != 0: no solution (inconsistent)
    • A = 0, B = 0: infinite solutions (identity)
    Parameters (2)
    • theA
      coefficient of x term
    • theB
      constant term
  • constructor(theA: number, theB: number, theC: number): math_DirectPolynomialRoots

    Computes all the real roots of the quadratic polynomial Ax^2 + Bx + C = 0 using numerically stable formulas.
    The algorithm avoids catastrophic cancellation by using:

    • Discriminant with error bounds: Delta = B^2 - 4AC
    • Stable root formulas based on sign of B
    • Newton-Raphson refinement for improved accuracy
    Parameters (3)
    • theA
      coefficient of x^2 term
    • theB
      coefficient of x term
    • theC
      constant term
  • constructor(theA: number, theB: number, theC: number, theD: number): math_DirectPolynomialRoots

    Computes all the real roots of the cubic polynomial Ax^3 + Bx^2 + Cx + D = 0 using Cardano's method with Vieta substitution.
    The algorithm:

    1. Transforms to depressed cubic t^3 + Pt + Q = 0
    2. Computes discriminant Delta = -4P^3/27 - Q^2/4
    3. Uses trigonometric method for Delta < 0 (three real roots)
    4. Uses Cardano's formula for Delta > 0 (one real root)
    5. Handles multiple roots when Delta = 0
    6. Applies Newton-Raphson refinement
    Parameters (4)
    • theA
      coefficient of x^3 term
    • theB
      coefficient of x^2 term
    • theC
      coefficient of x term
    • theD
      constant term
  • constructor(theA: number, theB: number, theC: number, theD: number, theE: number): math_DirectPolynomialRoots

    Computes all the real roots of the quartic polynomial Ax^4 + Bx^3 + Cx^2 + Dx + E = 0 using Ferrari's method.
    The algorithm:

    1. Checks for degree reduction (A ~= 0)
    2. Normalizes and scales coefficients for numerical stability
    3. Solves Ferrari's resolvent cubic equation
    4. Factors quartic into two quadratic equations
    5. Solves both quadratics independently
    6. Refines all roots using Newton-Raphson method
    Parameters (5)
    • theA
      coefficient of x^4 term
    • theB
      coefficient of x^3 term
    • theC
      coefficient of x^2 term
    • theD
      coefficient of x term
    • theE
      constant term

Instance methods(4)

  • IsDone(): boolean

    Returns true if the computations are successful, otherwise returns false. Computations may fail due to numerical issues or overflow conditions.

  • InfiniteRoots(): boolean

    Returns true if there is an infinity of roots, otherwise returns false. This occurs only for the degenerate linear case 0*x + 0 = 0.

  • NbSolutions(): number

    Returns the number of distinct real roots found. An exception is raised if there are an infinity of roots. For multiple roots, this counts each root according to its multiplicity.

  • Value(theIndex: number): number

    Returns the value of the Nth root in default ordering. The default ordering may vary depending on the algorithm used. An exception is raised if there are an infinity of roots. Exception RangeError is raised if theIndex is < 1 or theIndex > NbSolutions.

    Parameters (1)
    • theIndex
      root index (1-based)
    Returns

    root value

math_DoubleTab

Constructors(2)

  • Copy constructor.

    Parameters (1)
    • theOther
  • constructor(theLowerRow: number, theUpperRow: number, theLowerCol: number, theUpperCol: number): math_DoubleTab

    Constructor for ranges [theLowerRow..theUpperRow, theLowerCol..theUpperCol].

    Parameters (4)
    • theLowerRow
    • theUpperRow
    • theLowerCol
    • theUpperCol

Instance methods(12)

  • Init(theInitValue: number): void

    Initialize all elements with theInitValue.

    Parameters (1)
    • theInitValue
  • Copy(theOther: math_DoubleTab): void

    Copy data to theOther.

    Parameters (1)
    • theOther
  • IsDeletable(): boolean

    Returns true if the internal array is deletable (heap-allocated).

  • SetLowerRow(theLowerRow: number): void

    Set lower row index.

    Parameters (1)
    • theLowerRow
  • SetLowerCol(theLowerCol: number): void

    Set lower column index.

    Parameters (1)
    • theLowerCol
  • LowerRow(): number

    Get lower row index.

  • UpperRow(): number

    Get upper row index.

  • LowerCol(): number

    Get lower column index.

  • UpperCol(): number

    Get upper column index.

  • NbRows(): number

    Get number of rows.

  • NbColumns(): number

    Get number of columns.

  • Value(theRowIndex: number, theColIndex: number): number

    Access element at (theRowIndex, theColIndex).

    Parameters (2)
    • theRowIndex
    • theColIndex

math_EigenValuesSearcher

This class finds eigenvalues and eigenvectors of real symmetric tridiagonal matrices.
The implementation uses the QR algorithm with implicit shifts for numerical stability. All computed eigenvalues are real (since the matrix is symmetric), and eigenvectors are orthonormal. The class handles the complete eigendecomposition: A * V = V * D, where A is the input matrix, V contains eigenvectors as columns, and D is diagonal with eigenvalues.
Key features:

  • Robust QR algorithm implementation
  • Numerical stability through implicit shifts
  • Complete eigenvalue/eigenvector computation
  • Proper handling of degenerate cases

Constructors(1)

Instance methods(4)

  • IsDone(): boolean

    Returns true if computation is performed successfully. Computation may fail due to numerical issues or invalid input.

  • Dimension(): number

    Returns the dimension of the tridiagonal matrix.

  • EigenValue(theIndex: number): number

    Returns the specified eigenvalue. Eigenvalues are returned in the order they were computed by the algorithm, which may not be sorted. Use sorting if ordered eigenvalues are needed.

    Parameters (1)
    • theIndex
      index of the desired eigenvalue (1-based indexing)
    Returns

    the eigenvalue at the specified index

  • EigenVector(theIndex: number): math_Vector

    Returns the specified eigenvector. The returned eigenvector is normalized and orthogonal to all other eigenvectors. The eigenvector satisfies: A * v = lambda * v, where A is the original matrix, v is the eigenvector, and lambda is the corresponding eigenvalue.

    Parameters (1)
    • theIndex
      index of the desired eigenvector (1-based indexing)
    Returns

    the normalized eigenvector corresponding to EigenValue(theIndex)

math_FRPR

this class implements the Fletcher-Reeves-Polak_Ribiere minimization algorithm of a function of multiple variables. Knowledge of the function's gradient is required.

Constructors(1)

  • constructor(theFunction: math_MultipleVarFunctionWithGradient, theTolerance: number, theNbIterations?: number, theZEPS?: number): math_FRPR

    Initializes the computation of the minimum of F. Warning: constructor does not perform computations.

    Parameters (4)
    • theFunction
    • theTolerance
    • theNbIterations
    • theZEPS

Instance methods(9)

  • Perform(theFunction: math_MultipleVarFunctionWithGradient, theStartingPoint: math_Vector): void

    The solution F = Fi is found when 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS).

    Parameters (2)
    • theFunction
    • theStartingPoint
  • The solution F = Fi is found when: 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS. The maximum number of iterations allowed is given by NbIterations.

    Parameters (1)
    • theFunction
  • IsDone(): boolean

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

  • Location(): math_Vector

    returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.

  • Location(Loc: math_Vector): void

    outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.

    Parameters (1)
    • Loc
  • Minimum(): number

    returns the value of the minimum. Exception NotDone is raised if the minimum was not found.

  • Gradient(): math_Vector

    returns the gradient vector at the minimum. Exception NotDone is raised if the minimum was not found.

  • Gradient(Grad: math_Vector): void

    outputs the gradient vector at the minimum in Grad. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Grad is not equal to the range of the StartingPoint.

    Parameters (1)
    • Grad
  • NbIterations(): number

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

math_Function

This abstract class describes the virtual functions associated with a Function of a single variable.

Instance methods(2)

  • Value(X: number, F: number): { returnValue: boolean; F: number }

    Computes the value of the function <F> for a given value of variable <X>. returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • GetStateNumber(): number

    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.

math_FunctionAllRoots

This algorithm uses a sample of the function to find all intervals on which the function is null, and afterwards uses the FunctionRoots algorithm to find the points where the function is null outside the "null intervals". Knowledge of the derivative is required.

Constructors(1)

  • constructor(F: math_FunctionWithDerivative, S: math_FunctionSample, EpsX: number, EpsF: number, EpsNul: number): math_FunctionAllRoots

    The algorithm uses the sample to find intervals on which the function is null. An interval is found if, for at least two consecutive points of the sample, Ui and Ui+1, we get |F(Ui)|<=EpsNul and |F(Ui+1)|<=EpsNul. The real bounds of an interval are computed with the FunctionRoots. algorithm. Between two intervals, the roots of the function F are calculated using the FunctionRoots algorithm.

    Parameters (5)
    • F
    • S
    • EpsX
    • EpsF
    • EpsNul

Instance methods(7)

  • IsDone(): boolean

    Returns True if the computation has been done successfully.

  • NbIntervals(): number

    Returns the number of intervals on which the function is Null. An exception is raised if IsDone returns False.

  • GetInterval(Index: number, A: number, B: number): { A: number; B: number }

    Returns the interval of parameter of range Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.

    Parameters (3)
    • Index
    • A
    • B
    Returns

    A result object with fields:

    • A: updated value from the call.
    • B: updated value from the call.
  • GetIntervalState(Index: number, IFirst: number, ILast: number): { IFirst: number; ILast: number }

    returns the State Number associated to the interval Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.

    Parameters (3)
    • Index
    • IFirst
    • ILast
    Returns

    A result object with fields:

    • IFirst: updated value from the call.
    • ILast: updated value from the call.
  • NbPoints(): number

    returns the number of points where the function is Null. An exception is raised if IsDone returns False.

  • GetPoint(Index: number): number

    Returns the parameter of the point of range Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >NbPoints.

    Parameters (1)
    • Index
  • GetPointState(Index: number): number

    returns the State Number associated to the point Index. An exception is raised if IsDone returns False; An exception is raised if Index<=0 or Index >Nbintervals.

    Parameters (1)
    • Index

math_FunctionRoot

This class implements the computation of a root of a function of a single variable which is near an initial guess using a minimization algorithm.Knowledge of the derivative is required. The algorithm used is the same as in.

Constructors(2)

  • constructor(F: math_FunctionWithDerivative, Guess: number, Tolerance: number, NbIterations?: number): math_FunctionRoot

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

    Parameters (4)
    • F
    • Guess
    • Tolerance
    • NbIterations
  • constructor(F: math_FunctionWithDerivative, Guess: number, Tolerance: number, A: number, B: number, NbIterations?: number): math_FunctionRoot

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

    Parameters (6)
    • F
    • Guess
    • Tolerance
    • A
    • B
    • NbIterations

Instance methods(5)

  • IsDone(): boolean

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

  • Root(): number

    returns the value of the root. Exception NotDone is raised if the root was not found.

  • Derivative(): number

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

  • Value(): number

    returns the value of the function at the root. Exception NotDone is raised if the root was not found.

  • NbIterations(): number

    returns the number of iterations really done on the computation of the Root. Exception NotDone is raised if the root was not found.

math_FunctionRoots

This class implements an algorithm which finds all the real roots of a function with derivative within a given range. Knowledge of the derivative is required.

Constructors(1)

  • constructor(F: math_FunctionWithDerivative, A: number, B: number, NbSample: number, EpsX?: number, EpsF?: number, EpsNull?: number, K?: number): math_FunctionRoots

    Calculates all the real roots of a function F-K within the range A..B. without conditions on A and B A solution X is found when abs(Xi - Xi-1) <= Epsx and abs(F(Xi)-K) <= EpsF. The function is considered as null between A and B if abs(F-K) <= EpsNull within this range.

    Parameters (8)
    • F
    • A
    • B
    • NbSample
    • EpsX
    • EpsF
    • EpsNull
    • K

Instance methods(5)

  • IsDone(): boolean

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

  • IsAllNull(): boolean

    returns true if the function is considered as null between A and B. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).

  • NbSolutions(): number

    Returns the number of solutions found. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).

  • Value(Nieme: number): number

    Returns the Nth value of the root of function F. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false).

    Parameters (1)
    • Nieme
  • StateNumber(Nieme: number): number

    returns the StateNumber of the Nieme root. Exception RangeError is raised if Nieme is < 1 or Nieme > NbSolutions.

    Parameters (1)
    • Nieme

math_FunctionSample

This class gives a default sample (constant difference of parameter) for a function defined between two bound A,B.

Constructors(1)

Instance methods(3)

  • Bounds(A: number, B: number): { A: number; B: number }

    Returns the bounds of parameters.

    Parameters (2)
    • A
    • B
    Returns

    A result object with fields:

    • A: updated value from the call.
    • B: updated value from the call.
  • NbPoints(): number

    Returns the number of sample points.

  • GetParameter(Index: number): number

    Returns the value of parameter of the point of range Index : A + ((Index-1)/(NbPoints-1))*B. An exception is raised if Index<=0 or Index>NbPoints.

    Parameters (1)
    • Index

math_FunctionSet

This abstract class describes the virtual functions associated to a set on N Functions of M independent variables.

Instance methods(4)

  • NbVariables(): number

    Returns the number of variables of the function.

  • NbEquations(): number

    Returns the number of equations of the function.

  • Value(X: math_Vector, F: math_Vector): boolean

    Computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
  • GetStateNumber(): number

    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.

math_FunctionSetRoot

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

Constructors(2)

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

    Parameters (2)
    • F
    • NbIterations
  • constructor(F: math_FunctionSetWithDerivatives, Tolerance: math_Vector, NbIterations?: number): math_FunctionSetRoot

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

    Parameters (3)
    • F
    • Tolerance
    • NbIterations

Instance methods(14)

  • SetTolerance(Tolerance: math_Vector): void

    Initializes the tolerance values.

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

    Parameters (1)
    • argNo0
  • Perform(theFunction: math_FunctionSetWithDerivatives, theStartingPoint: math_Vector, theStopOnDivergent: boolean): void

    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.

    Parameters (3)
    • theFunction
    • theStartingPoint
    • theStopOnDivergent
  • Perform(theFunction: math_FunctionSetWithDerivatives, theStartingPoint: math_Vector, theInfBound: math_Vector, theSupBound: math_Vector, theStopOnDivergent: boolean): void

    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.

    Parameters (5)
    • theFunction
    • theStartingPoint
    • theInfBound
    • theSupBound
    • theStopOnDivergent
  • IsDone(): boolean

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

  • NbIterations(): number

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

  • StateNumber(): number

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

  • Root(): math_Vector

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

  • Root(Root: math_Vector): void

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

    Parameters (1)
    • Root
  • Returns the matrix value of the derivative at the root. Exception NotDone is raised if the root was not found.

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

    Parameters (1)
    • Der
  • FunctionSetErrors(): math_Vector

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

  • FunctionSetErrors(Err: math_Vector): void

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

    Parameters (1)
    • Err
  • IsDivergent(): boolean

math_FunctionSetWithDerivatives

This abstract class describes the virtual functions associated with a set of N Functions each of M independent variables.

Instance methods(5)

  • NbVariables(): number

    Returns the number of variables of the function.

  • NbEquations(): number

    Returns the number of equations of the function.

  • Value(X: math_Vector, F: math_Vector): boolean

    Computes the values <F> of the Functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
  • Derivatives(X: math_Vector, D: math_Matrix): boolean

    Returns the values <D> of the derivatives for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • D
  • Values(X: math_Vector, F: math_Vector, D: math_Matrix): boolean

    returns the values <F> of the functions and the derivatives <D> for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (3)
    • X
    • F
    • D

math_FunctionWithDerivative

This abstract class describes the virtual functions associated with a function of a single variable for which the first derivative is available.

Instance methods(3)

  • Value(X: number, F: number): { returnValue: boolean; F: number }

    Computes the value <F>of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Derivative(X: number, D: number): { returnValue: boolean; D: number }

    Computes the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • D: updated value from the call.
  • Values(X: number, F: number, D: number): { returnValue: boolean; F: number; D: number }

    Computes the value <F> and the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (3)
    • X
    • F
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
    • D: updated value from the call.

math_Gauss

This class implements the Gauss LU decomposition (Crout algorithm) with partial pivoting (rows interchange) of a square matrix and the different possible derived calculation :

  • solution of a set of linear equations.
  • inverse of a matrix.
  • determinant of a matrix.

Constructors(1)

  • constructor(A: math_Matrix, MinPivot?: number, theProgress?: Message_ProgressRange): math_Gauss

    Given an input n X n matrix A this constructor performs its LU decomposition with partial pivoting (interchange of rows). This LU decomposition is stored internally and may be used to do subsequent calculation. If the largest pivot found is less than MinPivot the matrix A is considered as singular. Exception NotSquare is raised if A is not a square matrix.

    Parameters (3)
    • A
    • MinPivot
    • theProgress

Instance methods(5)

  • IsDone(): boolean

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

  • Solve(B: math_Vector, X: math_Vector): void

    Given the input Vector B this routine returns the solution X of the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the number of rows of A.

    Parameters (2)
    • B
    • X
  • Solve(B: math_Vector): void

    Given the input Vector B this routine solves the set of linear equations A . X = B. B is replaced by the vector solution X. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the number of rows of A.

    Parameters (1)
    • B
  • Determinant(): number

    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.

  • Invert(Inv: math_Matrix): void

    This routine outputs Inv the inverse of the previously LU decomposed matrix A. Exception DimensionError is raised if the ranges of B are not equal to the ranges of A.

    Parameters (1)
    • Inv

math_GaussLeastSquare

This class implements the least square solution of a set of n linear equations of m unknowns (n >= m) using the gauss LU decomposition algorithm. This algorithm is more likely subject to numerical instability than math_SVD.

Constructors(1)

  • 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 is considered as singular.

    Parameters (2)
    • A
    • MinPivot

Instance methods(2)

  • IsDone(): boolean

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

  • Solve(B: math_Vector, X: math_Vector): void

    Given the input Vector this routine solves the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B Inv is not equal to the rowrange of A. Exception DimensionError is raised if the range of X Inv is not equal to the colrange of A.

    Parameters (2)
    • B
    • X

math_GaussMultipleIntegration

This class implements the integration of a function of multiple variables between the parameter bounds Lower[a..b] and Upper[a..b]. Warning: Each element of Order must be inferior or equal to 61.

Constructors(1)

Instance methods(2)

  • IsDone(): boolean

    returns True if all has been correctly done.

  • Value(): number

    returns the value of the integral.

math_GaussSetIntegration

This class implements the integration of a set of N functions of M variables variables between the parameter bounds Lower[a..b] and Upper[a..b]. Warning: The case M>1 is not implemented.

Constructors(1)

  • constructor(F: math_FunctionSet, Lower: math_Vector, Upper: math_Vector, Order: math_IntegerVector): math_GaussSetIntegration

    The Gauss-Legendre integration with Order = points of integration for each unknown, is done on the function F between the bounds Lower and Upper.

    Parameters (4)
    • F
    • Lower
    • Upper
    • Order

Instance methods(2)

  • IsDone(): boolean

    returns True if all has been correctly done.

  • Value(): math_Vector

    returns the value of the integral.

math_GaussSingleIntegration

This class implements the integration of a function of a single variable between the parameter bounds Lower and Upper. Warning: Order must be inferior or equal to 61.

Constructors(3)

Instance methods(2)

  • IsDone(): boolean

    returns True if all has been correctly done.

  • Value(): number

    returns the value of the integral.

math_GlobOptMin

This class represents Evtushenko's algorithm of global optimization based on non-uniform mesh. Article: Yu. Evtushenko. Numerical methods for finding global extreme (case of a non-uniform mesh). U.S.S.R. Comput. Maths. Math. Phys., Vol. 11, N 6, pp. 38-54.
This method performs search on non-uniform mesh. The search space is a box in R^n space. The default behavior is to find all minimums in that box. Computation of maximums is not supported.
The search box can be split into smaller boxes by discontinuity criteria. This functionality is covered by SetGlobalParams and SetLocalParams API.
It is possible to set continuity of the local boxes. Such option can forcibly change local extrema search. In other words if theFunc can be casted to the function with Hessian but, continuity is set to 1 Gradient based local optimization method will be used, not Hessian based method. This functionality is covered by SetContinuity and GetContinuity API.
It is possible to freeze Lipschitz const to avoid internal modifications on it. This functionality is covered by SetLipConstState and GetLipConstState API.
It is possible to perform single solution search. This functionality is covered by first parameter in Perform method.
It is possible to set / get minimal value of the functional. It works well together with single solution search. This functionality is covered by SetFunctionalMinimalValue and GetFunctionalMinimalValue API.

Constructors(1)

  • constructor(theFunc: math_MultipleVarFunction, theLowerBorder: math_Vector, theUpperBorder: math_Vector, theC?: number, theDiscretizationTol?: number, theSameTol?: number): math_GlobOptMin

    Constructor. Perform method is not called from it.

    Parameters (6)
    • theFunc
      • objective functional.
    • theLowerBorder
      • lower corner of the search box.
    • theUpperBorder
      • upper corner of the search box.
    • theC
      • Lipschitz constant.
    • theDiscretizationTol
      • parameter space discretization tolerance.
    • theSameTol
      • functional value space indifference tolerance.

Instance methods(15)

  • SetGlobalParams(theFunc: math_MultipleVarFunction, theLowerBorder: math_Vector, theUpperBorder: math_Vector, theC?: number, theDiscretizationTol?: number, theSameTol?: number): void
    Parameters (6)
    • theFunc
      • objective functional.
    • theLowerBorder
      • lower corner of the search box.
    • theUpperBorder
      • upper corner of the search box.
    • theC
      • Lipschitz constant.
    • theDiscretizationTol
      • parameter space discretization tolerance.
    • theSameTol
      • functional value space indifference tolerance.
  • SetLocalParams(theLocalA: math_Vector, theLocalB: math_Vector): void

    Method to reduce bounding box. Perform will use this box.

    Parameters (2)
    • theLocalA
      • lower corner of the local box.
    • theLocalB
      • upper corner of the local box.
  • SetTol(theDiscretizationTol: number, theSameTol: number): void

    Method to set tolerances.

    Parameters (2)
    • theDiscretizationTol
      • parameter space discretization tolerance.
    • theSameTol
      • functional value space indifference tolerance.
  • GetTol(theDiscretizationTol: number, theSameTol: number): { theDiscretizationTol: number; theSameTol: number }

    Method to get tolerances.

    Parameters (2)
    • theDiscretizationTol
      • parameter space discretization tolerance.
    • theSameTol
      • functional value space indifference tolerance.
    Returns

    A result object with fields:

    • theDiscretizationTol: - parameter space discretization tolerance.
    • theSameTol: - functional value space indifference tolerance.
  • Perform(isFindSingleSolution?: boolean): void
    Parameters (1)
    • isFindSingleSolution
      • defines whether to find single solution or all solutions.
  • Points(theIndex: number, theSol: math_Vector): void

    Return solution theIndex, 1 <= theIndex <= NbExtrema.

    Parameters (2)
    • theIndex
    • theSol
  • SetContinuity(theCont: number): void

    Set / Get continuity of local borders splits (0 ~ C0, 1 ~ C1, 2 ~ C2).

    Parameters (1)
    • theCont
  • GetContinuity(): number
  • SetFunctionalMinimalValue(theMinimalValue: number): void

    Set / Get functional minimal value.

    Parameters (1)
    • theMinimalValue
  • SetLipConstState(theFlag: boolean): void

    Set / Get Lipchitz constant modification state. True means that the constant is locked and unlocked otherwise.

    Parameters (1)
    • theFlag
  • GetLipConstState(): boolean
  • isDone(): boolean

    Return computation state of the algorithm.

  • GetF(): number

    Get best functional value.

  • NbExtrema(): number

    Return count of global extremas.

math_Jacobi

This class implements the Jacobi method to find the eigenvalues and the eigenvectors of a real symmetric square matrix. A sort of eigenvalues is done.

Constructors(1)

  • Given a Real n X n matrix A, this constructor computes all its eigenvalues and eigenvectors using the Jacobi method. The exception NotSquare is raised if the matrix is not square. No verification that the matrix A is really symmetric is done.

    Parameters (1)
    • A

Instance methods(5)

  • IsDone(): boolean

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

  • Values(): math_Vector

    Returns the eigenvalues vector. Exception NotDone is raised if calculation is not done successfully.

  • Value(Num: number): number

    returns the eigenvalue number Num. Eigenvalues are in the range (1..n). Exception NotDone is raised if calculation is not done successfully.

    Parameters (1)
    • Num
  • returns the eigenvectors matrix. Exception NotDone is raised if calculation is not done successfully.

  • Vector(Num: number, V: math_Vector): void

    Returns the eigenvector V of number Num. Eigenvectors are in the range (1..n). Exception NotDone is raised if calculation is not done successfully.

    Parameters (2)
    • Num
    • V

math_KronrodSingleIntegration

This class implements the Gauss-Kronrod method of integral computation.

Constructors(3)

  • An empty constructor.

  • constructor(theFunction: math_Function, theLower: number, theUpper: number, theNbPnts: number): math_KronrodSingleIntegration

    Constructor. Takes the function, the lower and upper bound values, the initial number of Kronrod points.

    Parameters (4)
    • theFunction
    • theLower
    • theUpper
    • theNbPnts
  • constructor(theFunction: math_Function, theLower: number, theUpper: number, theNbPnts: number, theTolerance: number, theMaxNbIter: number): math_KronrodSingleIntegration

    Constructor. Takes the function, the lower and upper bound values, the initial number of Kronrod points, the tolerance value and the maximal number of iterations as parameters.

    Parameters (6)
    • theFunction
    • theLower
    • theUpper
    • theNbPnts
    • theTolerance
    • theMaxNbIter

Static methods(1)

  • GKRule(theFunction: math_Function, theLower: number, theUpper: number, theGaussP: math_Vector, theGaussW: math_Vector, theKronrodP: math_Vector, theKronrodW: math_Vector, theValue: number, theError: number): { returnValue: boolean; theValue: number; theError: number }
    Parameters (9)
    • theFunction
    • theLower
    • theUpper
    • theGaussP
    • theGaussW
    • theKronrodP
    • theKronrodW
    • theValue
    • theError

Instance methods(8)

  • Perform(theFunction: math_Function, theLower: number, theUpper: number, theNbPnts: number): void

    Computation of the integral. Takes the function, the lower and upper bound values, the initial number of Kronrod points, the relative tolerance value and the maximal number of iterations as parameters. theNbPnts should be odd and greater then or equal to 3.

    Parameters (4)
    • theFunction
    • theLower
    • theUpper
    • theNbPnts
  • Perform(theFunction: math_Function, theLower: number, theUpper: number, theNbPnts: number, theTolerance: number, theMaxNbIter: number): void

    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: std::abs(Kronrod - Gauss)/std::abs(Kronrod) < theTolerance. theTolerance should be positive.

    Parameters (6)
    • theFunction
    • theLower
    • theUpper
    • theNbPnts
    • theTolerance
    • theMaxNbIter
  • IsDone(): boolean

    Returns true if computation is performed successfully.

  • Value(): number

    Returns the value of the integral.

  • ErrorReached(): number

    Returns the value of the relative error reached.

  • AbsolutError(): number

    Returns the value of the relative error reached.

  • OrderReached(): number

    Returns the number of Kronrod points for which the result is computed.

  • NbIterReached(): number

    Returns the number of iterations that were made to compute result.

math_Matrix

This class implements the real matrix abstract data type. Matrixes can have an arbitrary range which must be defined at the declaration and cannot be changed after this declaration math_Matrix(-3,5,2,4); //a vector with range [-3..5, 2..4] Matrix values may be initialized and retrieved using indexes which must lie within the range of definition of the matrix. Matrix objects follow "value semantics", that is, they cannot be shared and are copied through assignment Matrices are copied through assignment:

math_MatrixM2(1,9,1,3); ... M2=M1; M1(1)=2.0;//thematrixM2willnotbemodified.

The exception RangeError is raised when trying to access outside the range of a matrix :

M1(11,1)=0.0//-->willraiseRangeError.

The exception DimensionError is raised when the dimensions of two matrices or vectors are not compatible.

math_MatrixM3(1,2,1,2); M3=M1;//willraiseDimensionError M1.Add(M3)//-->willraiseDimensionError.

A Matrix can be constructed with a pointer to "c array". It allows to carry the bounds inside the matrix. Example :

doubletab1[10][20]; doubletab2[200]; math_MatrixA(tab1[0][0],1,10,1,20); math_MatrixB(tab2[0],1,10,1,20);

Constructors(3)

  • constructs a matrix for copy in initialization. An exception is raised if the matrixes have not the same dimensions.

    Parameters (1)
    • Other
  • constructor(LowerRow: number, UpperRow: number, LowerCol: number, UpperCol: number): math_Matrix

    Constructs a non-initialized matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] For the constructed matrix:

    • LowerRow and UpperRow are the indexes of the lower and upper bounds of a row, and
    • LowerCol and UpperCol are the indexes of the lower and upper bounds of a column.
    Parameters (4)
    • LowerRow
    • UpperRow
    • LowerCol
    • UpperCol
  • constructor(LowerRow: number, UpperRow: number, LowerCol: number, UpperCol: number, InitialValue: number): math_Matrix

    constructs a non-initialized matrix of range [LowerRow..UpperRow, LowerCol..UpperCol] whose values are all initialized with the value InitialValue.

    Parameters (5)
    • LowerRow
    • UpperRow
    • LowerCol
    • UpperCol
    • InitialValue

Instance methods(41)

  • Init(InitialValue: number): void

    Initialize all the elements of a matrix to InitialValue.

    Parameters (1)
    • InitialValue
  • RowNumber(): number

    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.
  • ColNumber(): number

    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.
  • LowerRow(): number

    Returns the value of the Lower index of the row range of a matrix.

  • UpperRow(): number

    Returns the Upper index of the row range of a matrix.

  • LowerCol(): number

    Returns the value of the Lower index of the column range of a matrix.

  • UpperCol(): number

    Returns the value of the upper index of the column range of a matrix.

  • Determinant(): number

    Computes the determinant of a matrix. An exception is raised if the matrix is not a square matrix.

  • Transpose(): void

    Transposes a given matrix. An exception is raised if the matrix is not a square matrix.

  • Invert(): void

    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.

  • Multiply(Right: number): void

    Sets this matrix to the product of the matrix Left, and the matrix Right. Example math_Matrix A (1, 3, 1, 3); math_Matrix B (1, 3, 1, 3); // A = ... , B = ... math_Matrix C (1, 3, 1, 3); C.Multiply(A, B); Exceptions Standard_DimensionError if matrices are of incompatible dimensions, i.e. if:

    • the number of columns of matrix Left, or the number of rows of matrix TLeft is not equal to the number of rows of matrix Right, or
    • the number of rows of matrix Left, or the number of columns of matrix TLeft is not equal to the number of rows of this matrix, or
    • the number of columns of matrix Right is not equal to the number of columns of this matrix.
    Parameters (1)
    • Right
  • Multiply(Right: math_Matrix): void

    Returns the product of 2 matrices. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • Multiply(Left: math_Vector, Right: math_Vector): void

    Computes a matrix as the product of 2 vectors. An exception is raised if the dimensions are different. <me> = <Left> * <Right>.

    Parameters (2)
    • Left
    • Right
  • Multiply(Left: math_Matrix, Right: math_Matrix): void

    Computes a matrix as the product of 2 matrixes. An exception is raised if the dimensions are different.

    Parameters (2)
    • Left
    • Right
  • Multiplied(Right: number): math_Matrix

    multiplies all the elements of a matrix by the value <Right>.

    Parameters (1)
    • Right
  • Returns the product of 2 matrices. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • Multiplied(Right: math_Vector): math_Vector

    Returns the product of a matrix by a vector. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • TMultiplied(Right: number): math_Matrix

    Sets this matrix to the product of the transposed matrix TLeft, and the matrix Right. Example math_Matrix A (1, 3, 1, 3); math_Matrix B (1, 3, 1, 3); // A = ... , B = ... math_Matrix C (1, 3, 1, 3); C.Multiply(A, B); Exceptions Standard_DimensionError if matrices are of incompatible dimensions, i.e. if:

    • the number of columns of matrix Left, or the number of rows of matrix TLeft is not equal to the number of rows of matrix Right, or
    • the number of rows of matrix Left, or the number of columns of matrix TLeft is not equal to the number of rows of this matrix, or
    • the number of columns of matrix Right is not equal to the number of columns of this matrix.
    Parameters (1)
    • Right
  • Divide(Right: number): void

    divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.

    Parameters (1)
    • Right
  • Divided(Right: number): math_Matrix

    divides all the elements of a matrix by the value <Right>. An exception is raised if <Right> = 0.

    Parameters (1)
    • Right
  • Add(Right: math_Matrix): void

    adds the matrix <Right> to a matrix. An exception is raised if the dimensions are different. Warning In order to save time when copying matrices, it is preferable to use operator += or the function Add whenever possible.

    Parameters (1)
    • Right
  • Add(Left: math_Matrix, Right: math_Matrix): void

    sets a matrix to the addition of <Left> and <Right>. An exception is raised if the dimensions are different.

    Parameters (2)
    • Left
    • Right
  • adds the matrix <Right> to a matrix. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • Subtract(Right: math_Matrix): void

    Subtracts the matrix <Right> from <me>. An exception is raised if the dimensions are different. Warning In order to avoid time-consuming copying of matrices, it is preferable to use operator -= or the function Subtract whenever possible.

    Parameters (1)
    • Right
  • Subtract(Left: math_Matrix, Right: math_Matrix): void

    Sets a matrix to the Subtraction of the matrix <Right> from the matrix <Left>. An exception is raised if the dimensions are different.

    Parameters (2)
    • Left
    • Right
  • Returns the result of the subtraction of <Right> from <me>. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • Set(I1: number, I2: number, J1: number, J2: number, M: math_Matrix): void

    Sets the values of this matrix,.

    • from index I1 to index I2 on the row dimension, and
    • from index J1 to index J2 on the column dimension, to those of matrix M. Exceptions Standard_DimensionError if:
    • I1 is less than the index of the lower row bound of this matrix, or
    • I2 is greater than the index of the upper row bound of this matrix, or
    • J1 is less than the index of the lower column bound of this matrix, or
    • J2 is greater than the index of the upper column bound of this matrix, or
    • I2 - I1 + 1 is not equal to the number of rows of matrix M, or
    • J2 - J1 + 1 is not equal to the number of columns of matrix M.
    Parameters (5)
    • I1
    • I2
    • J1
    • J2
    • M
  • SetRow(Row: number, V: math_Vector): void

    Sets the row of index Row of a matrix to the vector <V>. An exception is raised if the dimensions are different. An exception is raises if <Row> is inferior to the lower row of the matrix or <Row> is superior to the upper row.

    Parameters (2)
    • Row
    • V
  • SetCol(Col: number, V: math_Vector): void

    Sets the column of index Col of a matrix to the vector <V>. An exception is raised if the dimensions are different. An exception is raises if <Col> is inferior to the lower column of the matrix or <Col> is superior to the upper column.

    Parameters (2)
    • Col
    • V
  • SetDiag(Value: number): void

    Sets the diagonal of a matrix to the value . An exception is raised if the matrix is not square.

    Parameters (1)
    • Value
  • Row(Row: number): math_Vector

    Returns the row of index Row of a matrix.

    Parameters (1)
    • Row
  • Col(Col: number): math_Vector

    Returns the column of index <Col> of a matrix.

    Parameters (1)
    • Col
  • SwapRow(Row1: number, Row2: number): void

    Swaps the rows of index Row1 and Row2. An exception is raised if <Row1> or <Row2> is out of range.

    Parameters (2)
    • Row1
    • Row2
  • SwapCol(Col1: number, Col2: number): void

    Swaps the columns of index <Col1> and <Col2>. An exception is raised if <Col1> or <Col2> is out of range.

    Parameters (2)
    • Col1
    • Col2
  • Teturns the transposed of a matrix. An exception is raised if the matrix is not a square matrix.

  • 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.

  • Returns the product of the transpose of a matrix with the matrix <Right>. An exception is raised if the dimensions are different.

    Parameters (1)
    • Right
  • TMultiply(TLeft: math_Matrix, Right: math_Matrix): void

    Computes a matrix to the product of the transpose of the matrix <TLeft> with the matrix <Right>. An exception is raised if the dimensions are different.

    Parameters (2)
    • TLeft
    • Right
  • Value(Row: number, Col: number): number

    Accesses the value of index <Row> and <Col> of a matrix. An exception is raised if <Row> and <Col> are not in the correct range.

    Parameters (2)
    • Row
    • Col
  • Matrixes are copied through assignment. An exception is raised if the dimensions are different.

    Parameters (1)
    • Other
  • Returns the opposite of a matrix. An exception is raised if the dimensions are different.

math_MultipleVarFunction

Describes the virtual functions associated with a multiple variable function.

Instance methods(3)

  • NbVariables(): number

    Returns the number of variables of the function.

  • Value(X: math_Vector, F: number): { returnValue: boolean; F: number }

    Computes the values of the Functions <F> for the variable <X>. returns True if the computation was done successfully, otherwise false.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • GetStateNumber(): number

    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.

math_MultipleVarFunctionWithGradient

The abstract class MultipleVarFunctionWithGradient describes the virtual functions associated with a multiple variable function.

Instance methods(4)

  • NbVariables(): number

    Returns the number of variables of the function.

  • Value(X: math_Vector, F: number): { returnValue: boolean; F: number }

    Computes the values of the Functions <F> for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Gradient(X: math_Vector, G: math_Vector): boolean

    Computes the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • G
  • Values(X: math_Vector, F: number, G: math_Vector): { returnValue: boolean; F: number }

    computes the value <F> and the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (3)
    • X
    • F
    • G
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.

math_MultipleVarFunctionWithHessian

Instance methods(5)

  • NbVariables(): number

    returns the number of variables of the function.

  • Value(X: math_Vector, F: number): { returnValue: boolean; F: number }

    computes the values of the Functions <F> for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Gradient(X: math_Vector, G: math_Vector): boolean

    computes the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • G
  • Values(X: math_Vector, F: number, G: math_Vector): { returnValue: boolean; F: number }

    computes the value <F> and the gradient <G> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (3)
    • X
    • F
    • G
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Values(X: math_Vector, F: number, G: math_Vector, H: math_Matrix): { returnValue: boolean; F: number }

    computes the value <F>, the gradient <G> and the hessian <H> of the functions for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (4)
    • X
    • F
    • G
    • H
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.

math_NewtonFunctionRoot

This class implements the calculation of a root of a function of a single variable starting from an initial near guess using the Newton algorithm. Knowledge of the derivative is required.

Constructors(3)

  • constructor(F: math_FunctionWithDerivative, Guess: number, EpsX: number, EpsF: number, NbIterations?: number): math_NewtonFunctionRoot

    The Newton method is done to find the root of the function F from the initial guess Guess. The tolerance required on the root is given by Tolerance. The solution is found when : abs(Xi - Xi-1) <= EpsX and abs(F(Xi))<= EpsF The maximum number of iterations allowed is given by NbIterations.

    Parameters (5)
    • F
    • Guess
    • EpsX
    • EpsF
    • NbIterations
  • constructor(A: number, B: number, EpsX: number, EpsF: number, NbIterations?: number): math_NewtonFunctionRoot

    is used in a sub-class to initialize correctly all the fields of this class.

    Parameters (5)
    • A
    • B
    • EpsX
    • EpsF
    • NbIterations
  • constructor(F: math_FunctionWithDerivative, Guess: number, EpsX: number, EpsF: number, A: number, B: number, NbIterations?: number): math_NewtonFunctionRoot

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

    Parameters (7)
    • F
    • Guess
    • EpsX
    • EpsF
    • A
    • B
    • NbIterations

Instance methods(6)

  • Perform(F: math_FunctionWithDerivative, Guess: number): void

    is used internally by the constructors.

    Parameters (2)
    • F
    • Guess
  • IsDone(): boolean

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

  • Root(): number

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

  • Derivative(): number

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

  • Value(): number

    returns the value of the function at the root. Exception NotDone is raised if the root was not found.

  • NbIterations(): number

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

math_Powell

This class implements the Powell method to find the minimum of function of multiple variables (the gradient does not have to be known).

Constructors(1)

Instance methods(7)

  • Perform(theFunction: math_MultipleVarFunction, theStartingPoint: math_Vector, theStartingDirections: math_Matrix): void

    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).

    Parameters (3)
    • theFunction
    • theStartingPoint
    • theStartingDirections
  • Solution F = Fi is found when: 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS. The maximum number of iterations allowed is given by NbIterations.

    Parameters (1)
    • theFunction
  • IsDone(): boolean

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

  • Location(): math_Vector

    returns the location vector of the minimum. Exception NotDone is raised if the minimum was not found.

  • Location(Loc: math_Vector): void

    outputs the location vector of the minimum in Loc. Exception NotDone is raised if the minimum was not found. Exception DimensionError is raised if the range of Loc is not equal to the range of the StartingPoint.

    Parameters (1)
    • Loc
  • Minimum(): number

    Returns the value of the minimum. Exception NotDone is raised if the minimum was not found.

  • NbIterations(): number

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

math_PSO

In this class implemented variation of Particle Swarm Optimization (PSO) method. A. Ismael F. Vaz, L. N. Vicente "A particle swarm pattern search method for bound constrained global optimization".
Algorithm description: Init Section: At start of computation a number of "particles" are placed in the search space. Each particle is assigned a random velocity.
Computational loop: The particles are moved in cycle, simulating some "social" behavior, so that new position of a particle on each step depends not only on its velocity and previous path, but also on the position of the best particle in the pool and best obtained position for current particle. The velocity of the particles is decreased on each step, so that convergence is guaranteed.
Algorithm output: Best point in param space (position of the best particle) and value of objective function.
Pros: One of the fastest algorithms. Work over functions with a lot local extremums. Does not require calculation of derivatives of the functional.
Cons: Convergence to global minimum not proved, which is a typical drawback for all stochastic algorithms. The result depends on random number generator.
Warning: PSO is effective to walk into optimum surrounding, not to get strict optimum. Run local optimization from pso output point. Warning: In PSO used fixed seed in RNG, so results are reproducible.

Constructors(1)

  • constructor(theFunc: math_MultipleVarFunction, theLowBorder: math_Vector, theUppBorder: math_Vector, theSteps: math_Vector, theNbParticles?: number, theNbIter?: number): math_PSO

    Constructor.

    Parameters (6)
    • theFunc
      defines the objective function. It should exist during all lifetime of class instance.
    • theLowBorder
      defines lower border of search space.
    • theUppBorder
      defines upper border of search space.
    • theSteps
      defines steps of regular grid, used for particle generation. This parameter used to define stop condition (TerminalVelocity).
    • theNbParticles
      defines number of particles.
    • theNbIter
      defines maximum number of iterations.

Instance methods(2)

  • Perform(theSteps: math_Vector, theValue: number, theOutPnt: math_Vector, theNbIter: number): { theValue: number }

    Perform computations, particles array is constructed inside of this function.

    Parameters (4)
    • theSteps
    • theValue
    • theOutPnt
    • theNbIter
    Returns

    A result object with fields:

    • theValue: updated value from the call.
  • Perform(theParticles: math_PSOParticlesPool, theNbParticles: number, theValue: number, theOutPnt: math_Vector, theNbIter: number): { theValue: number }

    Perform computations with given particles array.

    Parameters (5)
    • theParticles
    • theNbParticles
    • theValue
    • theOutPnt
    • theNbIter
    Returns

    A result object with fields:

    • theValue: updated value from the call.

math_SVD

SVD implements the solution of a set of N linear equations of M unknowns without condition on N or M. The Singular Value Decomposition algorithm is used. For singular or nearly singular matrices SVD is a better choice than Gauss or GaussLeastSquare.

Constructors(1)

  • Given as input an n X m matrix A with n < m, n = m or n > m this constructor performs the Singular Value Decomposition.

    Parameters (1)
    • A

Instance methods(3)

  • IsDone(): boolean

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

  • Solve(B: math_Vector, X: math_Vector, Eps?: number): void

    Given the input Vector B this routine solves the set of linear equations A . X = B. Exception NotDone is raised if the decomposition of A was not done successfully. Exception DimensionError is raised if the range of B is not equal to the rowrange of A. Exception DimensionError is raised if the range of X is not equal to the colrange of A.

    Parameters (3)
    • B
    • X
    • Eps
  • PseudoInverse(Inv: math_Matrix, Eps?: number): void

    Computes the inverse Inv of matrix A such as A * Inverse = Identity. Exceptions StdFail_NotDone if the algorithm fails (and IsDone returns false). Standard_DimensionError if the ranges of Inv are compatible with the ranges of A.

    Parameters (2)
    • Inv
    • Eps

math_TrigonometricEquationFunction

This is function, which corresponds trigonometric equation astd::cos(x)std::cos(x) + 2bstd::cos(x)Sin(x) + cstd::cos(x) + d*Sin(x) + e = 0 See class math_TrigonometricFunctionRoots.

Constructors(1)

Instance methods(3)

  • Value(X: number, F: number): { returnValue: boolean; F: number }

    Computes the value <F>of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Derivative(X: number, D: number): { returnValue: boolean; D: number }

    Computes the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • D: updated value from the call.
  • Values(X: number, F: number, D: number): { returnValue: boolean; F: number; D: number }

    Computes the value <F> and the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (3)
    • X
    • F
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
    • D: updated value from the call.

math_TrigonometricFunctionRoots

This class implements the solutions of the equation astd::cos(x)std::cos(x) + 2bstd::cos(x)Sin(x) + cstd::cos(x) + d*Sin(x) + e The degree of this equation can be 4, 3 or 2.

Constructors(3)

  • constructor(D: number, E: number, InfBound: number, SupBound: number): math_TrigonometricFunctionRoots

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

    Parameters (4)
    • D
    • E
    • InfBound
    • SupBound
  • constructor(C: number, D: number, E: number, InfBound: number, SupBound: number): math_TrigonometricFunctionRoots

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

    Parameters (5)
    • C
    • D
    • E
    • InfBound
    • SupBound
  • constructor(A: number, B: number, C: number, D: number, E: number, InfBound: number, SupBound: number): math_TrigonometricFunctionRoots

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

    Parameters (7)
    • A
    • B
    • C
    • D
    • E
    • InfBound
    • SupBound

Instance methods(4)

  • IsDone(): boolean

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

  • InfiniteRoots(): boolean

    Returns true if there is an infinity of roots, otherwise returns false.

  • Value(Index: number): number

    Returns the solution of range Index. An exception is raised if NotDone. An exception is raised if Index>NbSolutions. An exception is raised if there is an infinity of solutions.

    Parameters (1)
    • Index
  • NbSolutions(): number

    Returns the number of solutions found. An exception is raised if NotDone. An exception is raised if there is an infinity of solutions.

math_Uzawa

This class implements a system resolution C*X = B with an approach solution X0. There are no conditions on the number of equations. The algorithm used is the Uzawa algorithm. It is possible to have equal or inequal (<) equations to solve. The resolution is done with a minimization of Norm(X-X0). If there are only equal equations, the resolution is directly done and is similar to Gauss resolution with an optimisation because the matrix is a symmetric matrix. (The resolution is done with Crout algorithm).

Constructors(2)

  • constructor(Cont: math_Matrix, Secont: math_Vector, StartingPoint: math_Vector, EpsLix?: number, EpsLic?: number, NbIterations?: number): math_Uzawa

    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 maximum 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 ConstructionError is raised if the line number of Cont is different from the length of Secont.

    Parameters (6)
    • Cont
    • Secont
    • StartingPoint
    • EpsLix
    • EpsLic
    • NbIterations
  • constructor(Cont: math_Matrix, Secont: math_Vector, StartingPoint: math_Vector, Nci: number, Nce: number, EpsLix?: number, EpsLic?: number, NbIterations?: number): math_Uzawa

    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 maximum 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 ConstructionError is raised if the line number of Cont is different from the length of Secont and from Nce + Nci.

    Parameters (8)
    • Cont
    • Secont
    • StartingPoint
    • Nci
    • Nce
    • EpsLix
    • EpsLic
    • NbIterations

Instance methods(7)

  • IsDone(): boolean

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

  • Value(): math_Vector

    Returns the vector solution of the system above. An exception is raised if NotDone.

  • InitialError(): math_Vector

    Returns the initial error Cont*StartingPoint-Secont. An exception is raised if NotDone.

  • Duale(V: math_Vector): void

    returns the duale variables V of the systeme.

    Parameters (1)
    • V
  • Error(): math_Vector

    Returns the difference between X solution and the StartingPoint. An exception is raised if NotDone.

  • NbIterations(): number

    returns the number of iterations really done. An exception is raised if NotDone.

  • returns the inverse matrix of (C * Transposed(C)). This result is needed for the computation of the gradient when approximating a curve.