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

◆ makeMutableMatrix()

template<class RingType>
virtual MutableMatrix * M2::ConcreteRing< RingType >::makeMutableMatrix ( size_t nrows,
size_t ncols,
bool dense ) const
inlinevirtual

Create either a dense or sparse MutableMatrix of the given size.

Reimplemented from Ring.

Definition at line 86 of file aring-glue.hpp.

89 {
90 // JY: The use of get here on R is safe because MutableMat will always keep
91 // a reference to this so long as it has a reference to R, and this is in
92 // the gc heap, so that reference keeps R alive. Really, the MutableMat
93 // constructor should probably be calling ring(), but ring() is not virtual
94 // and not every Ring is an instance of ConcreteRing.
95 if (dense)
96 return new MutableMat<DMat<RingType> >(this, R.get(), nrows, ncols);
97 else
98 return new MutableMat<SMat<RingType> >(this, R.get(), nrows, ncols);
99 }
std::unique_ptr< RingType > R