chsvlib
chsv helper source code

◆ mul_matrix_inplace()

void Chusov::Math::mul_matrix_inplace ( ValueType *  left_column_matrix,
const ValueType *  right_column_matrix,
std::size_t  left_rows,
std::size_t  left_columns_right_rows,
std::size_t  right_columns 
)

Performs a multiplication of two matrices represented by two-dimensional column-major arrays and writes the result in place of the left multiplicand.

Template Parameters
ValueTypeA type of a matrix element.
Parameters
[in,out]left_column_matrixA pointer to a buffer, that on input contains elements of the left multiplicand which is a column-major matrix of left_columns_right_rows by left_rows elements. On output the buffer contains the product of size left_rows * right_columns. Therefore, the function assumes that left_columns_right_rows <= right_columns.
[in]right_column_matrixA pointer to a buffer holding the right column-major matrix multiplicand of right_columns by left_columns_right_rows elements.
left_rowsA number of rows in the left multiplicand.
left_columns_right_rowsA number of columns in the left multiplicand and a number of rows in the right multiplicand. The function assumes that left_columns_right_rows <= right_columns.
right_columnsA number of columns in the right matrix multiplicand.
Exceptions
std::bad_allocThe function was unable to allocate memory necessary to perform the in-place multiplication.
Anyexceptions that originate from addition, multiplication or assignment of ValueType scalars.

To multiply matrices writing the difference in place of the second operand rather than the first one, use mul_matrix_inplace_rev. To write the product to a buffer different from buffers of both of the operands, use either mul_matrix_copy, to replace some other existing matrix with the product, or mul_matrix_construct to construct the result of multiplication in an uninitialized buffer.