chsvlib
chsv helper source code

◆ construct_diagonal_matrix()

void Chusov::Math::construct_diagonal_matrix ( ValueType *  column_matrix,
std::size_t  columns,
std::size_t  rows,
ValueType  diag 
)
noexcept

Constructs a diagonal column-major matrix in a specified buffer.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[out]column_matrixA buffer which receives the constructed matrix. The array must be sufficient to hold columns * rows elements of the type ValueType.
columnsA number of columns in the matrix to create.
rowsA number of rows in the matrix to create.
diagA value copy-constructed in places of the main diagonal of column_matrix.
Exceptions
Anyexception thrown by the default, copy or move constructors of ValueType.

Unlike construct_diagonal_matrix, this function performs inplace coopy-construction rather than copy-assignment of the elements.