chsvlib
chsv helper source code

◆ rearrange_matrix_construct()

void Chusov::Math::rearrange_matrix_construct ( 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 constructing the rearrangement in 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.
[out]outputA vector capable of holding at least column*rows elements to accept the rearranged matrix. Elements of the vector are sequentially copy-constructed 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-construction of the elements.

The elements of the resulting matrix are copy-constructed in place of the respective elements in the buffer output, that is the buffer is considered to be uninitialized, and no destruction of existing data nor assignment takes place. In order to replace a matrix, that is not the original matrix, with a rearranged copy of column_matrix, invoking copy-assignment rather than copy-construction, use rearrange_matrix_copy.

To rearrange matrix in place, use rearrange_matrix_inplace.