Macaulay2 Engine
Loading...
Searching...
No Matches

◆ rawMatrixCRA()

const Matrix * rawMatrixCRA ( const Matrix * f,
const Matrix * g,
mpz_srcptr m,
mpz_srcptr n )

Definition at line 61 of file cra.cpp.

62{
63 // Error handling:
64 if (f->get_ring() != g->get_ring())
65 {
66 ERROR("matrices have different base rings");
67 return nullptr;
68 }
69 if (f->rows()->rank() != g->rows()->rank() ||
70 f->cols()->rank() != g->cols()->rank())
71 {
72 ERROR("matrices have different shapes");
73 return nullptr;
74 }
75
76 // Assumption: f and g are either matrices over ZZ, or over a polynomial ring
77 // whose coeff
78 // ring is ZZ. The output is a matrix in the same ring.
79
80 mpz_t um, vn, mn;
81 mpz_init(um);
82 mpz_init(vn);
83 mpz_init(mn);
85 mpz_t result_coeff;
86 mpz_init(result_coeff);
87 Matrix *result = ChineseRemainder::CRA(f, g, um, vn, mn);
88 mpz_clear(um);
89 mpz_clear(vn);
90 mpz_clear(mn);
91 return result;
92}
static bool computeMultipliers(mpz_srcptr m, mpz_srcptr n, mpz_t result_um, mpz_t result_vn, mpz_t result_mn)
Definition cra.cpp:36
static ring_elem CRA(const PolyRing *R, const ring_elem f, const ring_elem g, mpz_srcptr um, mpz_srcptr vn, mpz_srcptr mn)
Definition cra.cpp:53
int rank() const
Definition freemod.hpp:105
const Ring * get_ring() const
Definition matrix.hpp:134
const FreeModule * rows() const
Definition matrix.hpp:144
const FreeModule * cols() const
Definition matrix.hpp:145
#define Matrix
Definition factory.cpp:14
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)

References Matrix::cols(), ChineseRemainder::computeMultipliers(), ChineseRemainder::CRA(), ERROR, Matrix::get_ring(), Matrix, FreeModule::rank(), result(), and Matrix::rows().