chsvlib
chsv helper source code

◆ rearrange_matrix_copy()

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

Rearranges columns of a matrix specified by a column-major two-dimensional array with respect to an array of integral indices of the columns and respectively copy-assigns the result to a destination buffer.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in]column_matrixA pointer to a two dimensional array of elements which represent a column-major matrix to rearrange.
columnsA number of columns in the matrix to rearrange.
rowsA number of rows in the matrix to rearrange.
[in,out]outputA vector of column*rows elements to accept the rearranged matrix. Elements of the vector are sequentially copy-assigned from the rearranged elements of column_matrix.
[in]permutation_indicesA pointer to an array of integral indices of columns in column_matrix in the desired order.
Exceptions
Anyexceptions that originate from invoking copy-assignment of the elements.

Elements of the resulting matrix after permutation of the columns are assigned to the respective elements of the destination buffer, i.e. by invoking copy-assignment for every element of the original matrix column_matrix upon respective element of output. In order to write the rearranged result to an uninitialized space, use rearrange_matrix_construct.

To permute columns in place, use rearrange_matrix_inplace.