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

◆ to_M2_MutableMatrix()

MutableMatrix * F4toM2Interface::to_M2_MutableMatrix ( const VectorArithmetic * VA,
coefficient_matrix * mat,
gb_array & gens,
gb_array & gb )
static

Definition at line 141 of file f4-m2-interface.cpp.

145{
146 int nrows = INTSIZE(mat->rows);
147 int ncols = INTSIZE(mat->columns);
148 MutableMatrix *M =
149 IM2_MutableMatrix_make(VA->ring(), nrows, ncols, false);
150 for (int r = 0; r < nrows; r++)
151 {
152 row_elem &row = mat->rows[r];
153 const ElementArray* coeffs;
154 if (row.coeffs.isNull())
155 {
156 if (row.monom == nullptr)
157 coeffs = & gens[row.elem]->f.coeffs;
158 else
159 coeffs = & gb[row.elem]->f.coeffs;
160 }
161 else
162 {
163 coeffs = & row.coeffs;
164 }
165 for (int i = 0; i < row.len; i++)
166 {
167 int c = row.comps[i];
168 ring_elem a = VA->ringElemFromElementArray(* coeffs, i);
169 M->set_entry(r, c, a);
170 }
171 }
172 return M;
173}
bool isNull() const
virtual bool set_entry(size_t r, size_t c, const ring_elem a)=0
ring_elem ringElemFromElementArray(const ElementArray &coeffs, int index) const
const Ring * ring() const
void gb(IntermediateBasis &F, int n)
MutableMatrix * IM2_MutableMatrix_make(const Ring *R, int nrows, int ncols, M2_bool is_dense)
column_array columns
Definition f4-types.hpp:179
packed_monomial monom
Definition f4-types.hpp:157
int * comps
Definition f4-types.hpp:163
ElementArray coeffs
Definition f4-types.hpp:162
#define INTSIZE(a)
Definition style.hpp:37

References row_elem::coeffs, coefficient_matrix::columns, row_elem::comps, row_elem::elem, gb(), IM2_MutableMatrix_make(), INTSIZE, ElementArray::isNull(), row_elem::len, row_elem::monom, VectorArithmetic::ring(), VectorArithmetic::ringElemFromElementArray(), coefficient_matrix::rows, and MutableMatrix::set_entry().

Referenced by F4GB::show_matrix().