chsvlib
chsv helper source code

◆ neg_matrix_construct()

void Chusov::Math::neg_matrix_construct ( const ValueType *restrict  input_column_matrix,
std::size_t  columns,
std::size_t  rows,
ValueType *restrict  result 
)

Computes arithmetic negation of a matrix and constructs the result in an uninitialized buffer.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in]input_column_matrixA pointer addressing a two-dimensional array of elements which represents a matrix, of size columns by rows elements, to negate.
columnsA number of columns in the input and resulting matrices.
rowsA number of rows in the input and resulting matrices.
[out]resultA pointer to a buffer sufficient to hold the resulting columns by rows two-dimensional array of elements of the negation result. The elements of the resulting matrix are constructed in place of the respective elements in result. The buffer must not overlap with input_column_matrix.
Exceptions
Anyexceptions thrown from negation or move-construction of ValueType elements.

The elements of the resulting matrix are constructed in place of the respective elements of the two-dimensional buffer pointed to by result which is considered uninitialized. That is, no destruction or assignment of elements in result takes place. In order to replace an existing matrix (different from input_column_matrix) with the negation result, one should use neg_matrix_copy which performs assignment of elements rather than their construction. In order to replace the original matrix with its additive inverse, use neg_matrix_inplace.