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

◆ matrixFromSparseMatrixGenerator()

template<typename Gen>
Matrix * matrixFromSparseMatrixGenerator ( Gen & G)

Definition at line 563 of file res-f4-m2-interface.cpp.

564{
565 const Ring* R = G.ring();
566 MatrixConstructor M(R->make_FreeModule(G.numRows()), R->make_FreeModule(G.numColumns()), nullptr);
567 for (auto i = G.begin(); i != G.end(); ++i)
568 {
569 for (int j=i.components().size()-1; j>=0; --j)
570 {
571 M.set_entry(i.components()[j], i.column(), R->from_long(i.coefficients()[j]));
572 }
573 }
574 return M.to_matrix();
575}
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
virtual FreeModule * make_FreeModule() const
Definition ring.cpp:53
virtual ring_elem from_long(long n) const =0
xxx xxx xxx
Definition ring.hpp:102
tbb::flow::graph G

References Ring::from_long(), G, Ring::make_FreeModule(), Matrix, MatrixConstructor::set_entry(), and MatrixConstructor::to_matrix().

Referenced by SchreyerFrame::rankUsingSparseMatrix().