An fmprb_mat_t represents a dense matrix over the real numbers, implemented as an array of entries of type fmprb_struct.
The dimension (number of rows and columns) of a matrix is fixed at initialization, and the user must ensure that inputs and outputs to an operation have compatible dimensions. The number of rows or columns in a matrix can be zero.
Contains a pointer to a flat array of the entries (entries), an array of pointers to the start of each row (rows), and the number of rows (r) and columns (c).
An fmprb_mat_t is defined as an array of length one of type fmprb_mat_struct, permitting an fmprb_mat_t to be passed by reference.
Macro giving a pointer to the entry at row i and column j.
Returns the number of rows of the matrix.
Returns the number of columns of the matrix.
Initializes the matrix, setting it to the zero matrix with r rows and c columns.
Clears the matrix, deallocating all entries.
Sets dest to src. The operands must have identical dimensions.
Prints each entry in the matrix with the specified number of decimal digits.
Returns nonzero iff the matrices have the same dimensions and identical entries.
Returns nonzero iff the matrices have the same dimensions and each entry in mat1 overlaps with the corresponding entry in mat2.
Returns nonzero iff the matrices have the same dimensions and each entry in mat2 is contained in the corresponding entry in mat1.
Sets all entries in mat to zero.
Sets the entries on the main diagonal to ones, and all other entries to zero.
Sets b to an upper bound for the infinity norm (i.e. the largest absolute value row sum) of A, computed using floating-point arithmetic at prec bits with all operations rounded up.
Sets dest to the exact negation of src. The operands must have the same dimensions.
Sets res to the sum of mat1 and mat2. The operands must have the same dimensions.
Sets res to the difference of mat1 and mat2. The operands must have the same dimensions.
Sets res to the matrix product of mat1 and mat2. The operands must have compatible dimensions for matrix multiplication.
The threaded version splits the computation over the number of threads returned by flint_get_num_threads(). The default version automatically calls the threaded version if the matrices are sufficiently large and more than one thread can be used.
Sets res to mat raised to the power exp. Requires that mat is a square matrix.
Sets B to A multiplied by \(2^c\).
Sets B to \(B + A \times c\).
Sets B to \(A \times c\).
Sets B to \(A / c\).
Given an \(n \times n\) matrix \(A\), computes an LU decomposition \(PLU = A\) using Gaussian elimination with partial pivoting. The input and output matrices can be the same, performing the decomposition in-place.
Entry \(i\) in the permutation vector perm is set to the row index in the input matrix corresponding to row \(i\) in the output matrix.
The algorithm succeeds and returns nonzero if it can find \(n\) invertible (i.e. not containing zero) pivot entries. This guarantees that the matrix is invertible.
The algorithm fails and returns zero, leaving the entries in \(P\) and \(LU\) undefined, if it cannot find \(n\) invertible pivot elements. In this case, either the matrix is singular, the input matrix was computed to insufficient precision, or the LU decomposition was attempted at insufficient precision.
Solves \(AX = B\) given the precomputed nonsingular LU decomposition \(A = PLU\). The matrices \(X\) and \(B\) are allowed to be aliased with each other, but \(X\) is not allowed to be aliased with \(LU\).
Solves \(AX = B\) where \(A\) is a nonsingular \(n \times n\) matrix and \(X\) and \(B\) are \(n \times m\) matrices, using LU decomposition.
If \(m > 0\) and \(A\) cannot be inverted numerically (indicating either that \(A\) is singular or that the precision is insufficient), the values in the output matrix are left undefined and zero is returned. A nonzero return value guarantees that \(A\) is invertible and that the exact solution matrix is contained in the output.
Sets \(X = A^{-1}\) where \(A\) is a square matrix, computed by solving the system \(AX = I\).
If \(A\) cannot be inverted numerically (indicating either that \(A\) is singular or that the precision is insufficient), the values in the output matrix are left undefined and zero is returned. A nonzero return value guarantees that the matrix is invertible and that the exact inverse is contained in the output.
Computes the determinant of the matrix, using Gaussian elimination with partial pivoting. If at some point an invertible pivot element cannot be found, the elimination is stopped and the magnitude of the determinant of the remaining submatrix is bounded using Hadamard’s inequality.
Sets B to the exponential of the matrix A, defined by the Taylor series
The function is evaluated as \(\exp(A/2^r)^{2^r}\), where \(r\) is chosen to give rapid convergence of the Taylor series. The series is evaluated using rectangular splitting. If \(\|A/2^r\| \le c\) and \(N \ge 2c\), we bound the entrywise error when truncating the Taylor series before term \(N\) by \(2 c^N / N!\).