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

◆ mutableMatrix_from_NTL_mat_ZZ()

MutableMatrix * mutableMatrix_from_NTL_mat_ZZ ( const NTL::mat_ZZ * A)

Definition at line 31 of file ntl-interface.cpp.

32{
33 // AGAIN: form the TRANSPOSE of A
34 size_t ncols = A->NumRows();
35 size_t nrows = A->NumCols();
36 MutableMatrix *B = MutableMatrix::zero_matrix(globalZZ, nrows, ncols, false);
37
38 mpz_t a;
39 mpz_init(a);
40
41 for (size_t i = 0; i < ncols; i++)
42 for (size_t j = 0; j < nrows; j++)
43 {
44 if ((*A)(i + 1, j + 1) != 0)
45 {
46 mat_ZZ_get_entry(A, i, j, a);
47 B->set_entry(j, i, ring_elem(a));
48 }
49 }
50 mpz_clear(a);
51 return B;
52}
static MutableMatrix * zero_matrix(const Ring *R, size_t nrows, size_t ncols, bool dense)
Definition mat.cpp:54
virtual bool set_entry(size_t r, size_t c, const ring_elem a)=0
Abstract base class for mutable matrices over an arbitrary engine Ring, the in-place counterpart of t...
Definition mat.hpp:79
RingZZ * globalZZ
Definition relem.cpp:13
void mat_ZZ_get_entry(const NTL::mat_ZZ *A, long i, long j, mpz_t result)

References globalZZ, mat_ZZ_get_entry(), MutableMatrix::set_entry(), and MutableMatrix::zero_matrix().