34#include <M2/gc-include.h>
36#pragma GCC diagnostic push
37#pragma GCC diagnostic ignored "-Wconversion"
38#include <flint/nmod_mat.h>
39#pragma GCC diagnostic pop
72 result_det = nmod_mat_det(
mMatrix.nmod_mat());
78 mp_limb_signed_t* perm =
newarray_atomic(mp_limb_signed_t, LU.numRows());
79 nmod_mat_lu(perm, LU.nmod_mat(),
false);
88 mp_limb_signed_t* perm =
newarray_atomic(mp_limb_signed_t, LU.numRows());
89 nmod_mat_lu(perm, LU.nmod_mat(),
false);
91 for (
long i = 0; i < LU.numRows(); i++) P.push_back(perm[i]);
103 nmod_mat_solve(X.nmod_mat(),
mMatrix.nmod_mat(), B.nmod_mat());
104 return (isinvertible != 0);
110 long nrows =
mMatrix.numRows();
111 long ncols =
mMatrix.numColumns();
112 std::vector<size_t> profile;
115 nmod_mat_rref(AB.nmod_mat());
117 if (profile.size() >= 1 and profile[profile.size() - 1] >= ncols)
125 for (
long r = 0; r < profile.size(); r++)
138 return nmod_mat_inv(result_inv.nmod_mat(), A.nmod_mat());
148 nmod_mat_nullspace(result_nullspace.nmod_mat(),
mMatrix.nmod_mat());
ElementType & entry(size_t row, size_t column)
void resize(size_t new_nrows, size_t new_ncols)
size_t numColumns() const
RingType::ElementType ElementType
void matrixPLU(std::vector< size_t > &P, Mat &L, Mat &U)
void columnRankProfile(std::vector< size_t > &profile)
bool inverse(Mat &result_inv)
size_t kernel(Mat &result_nullspace)
M2::ARingZZpFlint RingType
bool solve(const Mat &B, Mat &X)
void determinant(ElementType &result_det)
bool solveInvertible(const Mat &B, Mat &X)
static void setUpperLower(const Mat &LU, Mat &lower, Mat &upper)
static void computePivotColumns(const Mat &LU, std::vector< size_t > &result_columns)
aring-style adapter for Z/p with p a word-size prime, backed by FLINT's nmod_* routines.
static void concatenateMatrices(const Mat &A, const Mat &B, Mat &C)
#define newarray_atomic(T, len)