factorize#

AnsSolver.factorize(mat, algo=None, inplace=True)[source]#

Factorize a matrix

Perform the numerical factorization of a linear solver system (Ax=b).

Warning

By default, factorization modifies the input matrix mat in place. This behavior can be changed using the inplace argument.

Parameters:
matansys.mapdl.math.AnsMat

An ansys.mapdl.math matrix.

algostr, optional

Factorization algorithm. Either "LAPACK" (default for dense matrices) or "DSP" (default for sparse matrices).

inplacebool, optional

If False, the factorization is performed on a copy of the input matrix (mat argument), hence this input matrix (mat) is not changed. Default is True.

Examples

Factorize a random matrix and solve a linear system.

>>> mm = mapdl.math
>>> dim = 1000
>>> m2 = mm.rand(dim, dim)
>>> solver = mm.factorize(m2)
>>> b = mm.ones(dim)
>>> x = solver.solve(b)