bool Chusov::Math::matrix_inverse_copy | ( | const ValueType *restrict | column_matrix, |
std::size_t | n, | ||
ValueType *restrict | inverse | ||
) |
Computes a multiplicative inverse of a matrix and assigns it to a different matrix.
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 . | |
[in,out] | inverse | Points to a two-dimensional array of n2 elements which receives the reciprocal of column_matrix . The buffer must not overlap with 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
becomes unspecified but valid, i.e. the elements of the output matrix have an unspecified but valid values that might need destruction.
The function performs assignment of the result of computation to the buffer pointed to by inverse
which implies that on input inverse
must address an array in which all n2
elements are valid prior to the call. To write the reciprocal into an uninitialized buffer, use matrix_inverse_construct.
To compute the inverse in place of the original matrix, use matrix_inverse_inplace.