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

◆ add()

template<typename Mat>
virtual MutableMat * MutableMat< Mat >::add ( const MutableMatrix * B) const
inlinevirtual

Implements MutableMatrix.

Definition at line 655 of file mutablemat-defs.hpp.

657 {
658 const Mat* B1 = B->coerce_const<Mat>();
659 if (B1 == NULL)
660 {
661 ERROR("expected matrices with the same ring and sparsity");
662 return NULL;
663 }
664 if (B->get_ring() != get_ring())
665 {
666 ERROR("expected matrices with the same ring");
667 return NULL;
668 }
669 if (B1->numRows() != n_rows() || B1->numColumns() != n_cols())
670 {
671 ERROR("expected matrices of the same shape");
672 return NULL;
673 }
674
677 return result;
678 }
virtual size_t n_rows() const
virtual size_t n_cols() const
virtual MutableMat * clone() const
virtual const Ring * get_ring() const
const MatT * coerce_const() const
Definition mat.hpp:159
const int ERROR
Definition m2-mem.cpp:55
void addInPlace(DMat< RT > &A, const DMat< RT > &B)

References MatrixOps::addInPlace(), clone(), ERROR, get_ring(), MutableMat(), MutableMatrix::MutableMatrix(), n_cols(), n_rows(), and result().