chsvlib
chsv helper source code

◆ decompose_lup_copy()

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

Performs an LUP decomposition of a square column-major matrix, assigning the L and U components, as a single matrix, to a buffer and writing the permutation of LU expressed as an array of column indices.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in]column_matrixA pointer to the square matrix, of n by n elements, to decompose. The matrix is represented by a column-major two-dimensional array of ValueType elements.
nA number of columns and a number of rows in the matrix to decompose.
[in,out]luA buffer holding n2 elements of the type ValueType where the unified LU decomposition is assigned to. The LU decomposition assigned to lu is expressed as a single column-major matrix in which lower-left triangular part which includes the main diagonal of lu holds elements of the L component of decomposition, and the upper-right part stores the U component with the main diagonal elements always equal to ValueType(1) and as such not stored explicitly.
[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.

The resulting unified matrix is written to lu using assignment of elements it is composed of rather than construction of those elements. Therefore, elements addressed by lu must be valid prior to the invocation of decompose_lup_copy. To assign the unified decomposition to an uninitialized buffer, use decompose_lup_construct.

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.