chsvlib
chsv helper source code

◆ sub_matrix_construct()

void Chusov::Math::sub_matrix_construct ( const ValueType *restrict  left_column_matrix,
const ValueType *restrict  right_column_matrix,
std::size_t  columns,
std::size_t  rows,
ValueType *restrict  result 
)

Calculates a difference between two matrices specified as two-dimensional arrays of scalars and constructs the resulting matrix in an uninitialized buffer.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in]left_column_matrixA pointer which addresses the left operand, the minuend, which is a matrix of columns by rows elements.
[in]right_column_matrixA pointer to the subtrahend matrix of columns by rows elements.
columnsA number of columns in the matrices to subtract.
rowsA number of rows in the matrices to subtract.
[out]resultA pointer to a buffer sufficient to hold the resulting columns by rows two-dimensional array of elements of the difference. The elements of the resulting matrix are constructed in place of the respective elements in result. The buffer must not overlap with either left_column_matrix or right_column_matrix.
Exceptions
Anyexceptions thrown from subtraction 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 both left_column_matrix and right_column_matrix) with the difference, one should use sub_matrix_copy which performs assignment of elements rather than their construction. In order to perform subtraction in place, use sub_matrix_inplace or sub_matrix_inplace_rev.