qmat.mathutils ============== .. py:module:: qmat.mathutils .. autoapi-nested-parse:: Base module for math utility functions Functions --------- .. autoapisummary:: qmat.mathutils.numericalOrder qmat.mathutils.lduFactorization qmat.mathutils.getExtrapolationMatrix Module Contents --------------- .. py:function:: numericalOrder(nSteps, err) 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. .. py:function:: lduFactorization(A: numpy.ndarray) 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. .. py:function:: getExtrapolationMatrix(nodes, times, pOrder=None) 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. :rtype: np.2darray, shape (N, M)