chsvlib
chsv helper source code

◆ decompose_lup_explicit_copy()

LU_status Chusov::Math::decompose_lup_explicit_copy ( 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 copy-assigns the three results to 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.
[in,out]LA buffer of columns by rows elements which accept the lower-triangular component of the decomposition.
[in,out]UA pointer to a square matrix of columns by columns elements which the upper-triangular component of the decomposition is assigned to. The main diagonal of the U component always contains multiplicative identities, ValueType(1), on output.
[in,out]PA pointer to a square matrix of columns by columns elements, which the permutation matrix is assigned to.
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 assigned to, rather than constructed in, buffers pointed to by, respectively, L, U and P. Therefore, elements of those matrices must be valid prior to the invocation of decompose_lup_explicit_copy. To assign decomposition to uninitialized buffers, use decompose_lup_explicit_construct.

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_copy, decompose_lup_inplace.