bool Chusov::Math::matrix_inverse_construct | ( | const ValueType *restrict | column_matrix, |
std::size_t | n, | ||
ValueType *restrict | inverse | ||
) |
Computes a multiplicative inverse of a matrix and constructs the reciprocal matrix in an uninitialized memory buffer.
ValueType | A type of a matrix element. |
[in] | column_matrix | A column-major two-dimensional array which represents the input matrix, of n by n elements, to invert. |
n | A number of columns and a number of rows in column_matrix . | |
[out] | inverse | Points to a buffer capable of holding n2 elements of the type ValueType . On successful invocation the buffer receives the reciprocal of column_matrix . |
true
, if the reciprocal of the matrix is successfully calculated, and false
, if the input matrix is singular and thus does not have a reciprocal. std::bad_alloc | The function failed to allocate memory necessary to complete the operation. |
If the function returns false
or throws an exception, the content of inverse
is left uninitialized.
The output buffer addressed by inverse
is assumed uninitialized on input. No destruction of anything that was in inverse
prior to the invocation of the function takes place.
To replace an array of existing n2
elements in a buffer different from input one, use matrix_inverse_copy.
To compute the inverse in place of the original matrix, use matrix_inverse_inplace.