chsvlib
chsv helper source code

◆ decompose_lup_inplace()

LU_status Chusov::Math::decompose_lup_inplace ( ValueType *restrict  column_matrix,
std::size_t  n,
std::size_t *restrict  P 
)
noexcept

Performs an in-place LUP decomposition of a square column-major matrix with the L and U components packed to a single square matrix and writes the permutation of LU expressed as an array of column indices.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in,out]column_matrixA pointer to a buffer which on input contains the square matrix, of n by n elements, to decompose. On output the buffer holds the LU-decomposition such that lower-left triangular part, including the main diagonal, holds elements of the L component of decomposition, and the upper-right part holds the U component with the main diagonal elements always equal to ValueType(1) and as such not stored explicitly. Both input and output matrix values are represented by a column-major two-dimensional array of ValueType elements.
nA number of columns and a number of rows of the matrix.
[out]PA pointer to a one-dimensional array of indices of columns of the product of the L and U components rearranged as a result of permutation. One can reconstruct the permutation matrix from this array using set_permutation_scaling_matrix or construct_permutation_scaling_matrix.
Returns
Properties of the LUP-decomposition defined as a bitmask of the LU_status enumeration type.

To construct this packed form of the decomposition to a different buffer, use either decompose_lup_construct, if the destination buffer is not initialized, or decompose_lup_copy, if the destination buffer already contains valid values of the type ValueType.

To decompose a square matrix in place, use decompose_lup_inplace.

To obtain the decomposition components in an explicit matrix form or to decompose a rectangular matrix, use decompose_lup_explicit_copy or decompose_lup_explicit_construct.