示例#1
0
void SparseMatrix::rowToPolynomial(
  const RowIndex row,
  const std::vector<PolyRing::Monoid::ConstMonoPtr>& colMonomials,
  Poly& poly
) {
  poly.setToZero();
  poly.reserve(entryCountInRow(row));
  const auto end = rowEnd(row);
  for (auto it = rowBegin(row); it != end; ++it) {
    MATHICGB_ASSERT(it.index() < colMonomials.size());
    if (it.scalar() != 0)
      poly.append(it.scalar(), *colMonomials[it.index()]);
  }
  MATHICGB_ASSERT(poly.termsAreInDescendingOrder());
}