qmat.mathutils
Base module for math utility functions
Functions
|
Compute numerical order from two vectors containing the error and the number of time-steps. |
Perform LDU factorization on a square matrix A. |
|
|
Generate a polynomial based extrapolation matrix, |
Module Contents
- numericalOrder(nSteps, err)[source]
Compute numerical order from two vectors containing the error and the number of time-steps.
- Parameters:
nSteps (np.1darray or list) – Different number of steps to compute the error.
err (np.1darray) – Diffenrent error values associated to the number of steps.
- Returns:
beta (float) – Order coefficient computed through linear regression.
rmse (float) – The root mean square error of the linear regression.
- lduFactorization(A: numpy.ndarray)[source]
Perform LDU factorization on a square matrix A.
- Parameters:
A (np.2darray) – The square matrix to factorize (n x n).
- Returns:
L (np.2darray) – Lower triangular matrix with ones on the diagonal.
D (np.2darray) – Diagonal matrix.
U (np.2darray) – Upper triangular matrix with ones on the diagonal.
- getExtrapolationMatrix(nodes, times, pOrder=None)[source]
Generate a polynomial based extrapolation matrix, base on polynomial regression of a function represented on given nodes.
- Parameters:
nodes (np.1darray like, shape (M,)) – The nodes where function values are known.
times (np.1darray like, shape (N,)) – The times where to extrapolate the polynomial.
pOrder (int) – Order of the polynomial regression on the node values (default = len(nodes)-1).
- Returns:
P – Extrapolation matrix, that can be used on any node values.
- Return type:
np.2darray, shape (N, M)