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

◆ subtract()

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

Implements MutableMatrix.

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

689 {
690 const Mat* B1 = B->coerce_const<Mat>();
691 if (B1 == NULL)
692 {
693 ERROR("expected matrices with the same ring and sparsity");
694 return NULL;
695 }
696 if (B->get_ring() != get_ring())
697 {
698 ERROR("expected matrices with the same ring");
699 return NULL;
700 }
701 if (B1->numRows() != n_rows() || B1->numColumns() != n_cols())
702 {
703 ERROR("expected matrices of the same shape");
704 return NULL;
705 }
706
709 return result;
710 }
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 subtractInPlace(DMat< RT > &A, const DMat< RT > &B)

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