169{
170 int nrows =
static_cast<int>(A.
numRows());
174 if (nrows == 0 || ncols == 0)
return result.to_matrix();
175
176 for (int r = 0; r < nrows; ++r)
177 for (int c = 0; c < ncols; ++c)
178 {
179 const typename CoeffRing::ElementType & a = A.
entry(r,c);
180 if (not A.
ring().is_zero(a))
181 {
183 A.
ring().to_ring_elem(ra, a);
184 result.set_entry(r, c, ra);
185 }
186 }
187
188 result.compute_column_degrees();
189 return result.to_matrix();
190}
ElementType & entry(size_t row, size_t column)
const ACoeffRing & ring() const
size_t numColumns() const
Engine-side free module R^n over a Ring.
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
virtual FreeModule * make_FreeModule() const
VALGRIND_MAKE_MEM_DEFINED & result(result)