chsvlib
chsv helper source code

◆ rearrange_matrix_inplace()

void Chusov::Math::rearrange_matrix_inplace ( ValueType *restrict  column_matrix,
std::size_t  columns,
std::size_t  rows,
const std::size_t *restrict  permutation_indices 
)
noexcept

Performs an in-place permutation of columns of a matrix specified by a column-major two-dimensional array with respect to an array of integral indices of the columns.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in,out]column_matrixA pointer to a two dimensional array of elements which represent a column-major matrix to rearrange in place.
columnsA number of columns in the matrix to rearrange.
rowsA number of rows in the matrix to rearrange.
[in]permutation_indicesA pointer to an array of integral indices of columns in column_matrix in the desired order.
Exceptions
Anyexceptions that originate from swapping of two elements of column_matrix.

In order to keep the original matrix intact and construct the result of the permutation in an uninitialized buffer, use rearrange_matrix_copy.

In order to write the result of the buffer and replace some other matrix with the result of the permutation, use rearrange_matrix_copy.