chsvlib
chsv helper source code

◆ decompose_lup_explicit_construct()

LU_status Chusov::Math::decompose_lup_explicit_construct ( const ValueType *restrict  column_matrix,
std::size_t  columns,
std::size_t  rows,
ValueType *restrict  L,
ValueType *restrict  U,
ValueType *restrict  P 
)
noexcept

Performs an LUP decomposition of a column-major matrix and constructs the three results in three separate buffers.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in]column_matrixA pointer to the matrix to decompose. The matrix is represented by a column-major two-dimensional array of ValueType elements.
columnsA number of columns in the matrix to decompose.
rowsA number of rows in the matrix to decompose.
[out]LA buffer of columns by rows elements which accept the lower-triangular component of the decomposition.
[out]UA pointer to a square matrix, of columns by columns elements, where the upper-triangular component of the decomposition is constructed. The main diagonal of the U component always contains multiplicative identities, ValueType(1), on output.
[out]PA pointer to a square matrix, of columns by columns elements, where the permutation matrix is constructed.
Returns
Properties of the LUP-decomposition defined as a bitmask of the LU_status enumeration type. If the result signals singularity, then only the L component will be singular. Neither the upper, U, component not the permutation matrix will be singular.

The resulting matrices, L, U and P, are constructed in, rather than assigned-to, buffers pointed to by, respectively, L, U and P. Therefore, no destruction of anything in the buffers is performed by the function which considers memory addressed by L, U and P to be uninitialized. In order to replace old values in L, U and P, rather than construct new ones, use decompose_lup_explicit_copy.

The function assumes the following preconditions are met:

  • Rows(L) == Rows(column_matrix);
  • Columns(L) == Rows(U) == Columns(U) == Rows(P) == Columns(P) == Columns(column_matrix), where Rows(X) and Columns(X) are respectively the numbers of rows and columns the matrix/buffer X holds/capable of holding.
    See also
    decompose_lup_construct, decompose_lup_inplace.