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

◆ submatrix() [2/2]

template<typename Mat>
virtual MutableMatrix * MutableMat< Mat >::submatrix ( M2_arrayint rows,
M2_arrayint cols ) const
inlinevirtual

Implements MutableMatrix.

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

585 {
586 for (size_t r = 0; r < rows->len; r++)
587 if (rows->array[r] < 0 || rows->array[r] >= n_rows())
588 {
589 ERROR(
590 "row index %d out of bounds 0..%d", rows->array[r], n_rows() - 1);
591 return 0;
592 }
593 for (size_t c = 0; c < cols->len; c++)
594 if (cols->array[c] < 0 || cols->array[c] >= n_cols())
595 {
596 ERROR("column index %d out of bounds 0..%d",
597 cols->array[c],
598 n_cols() - 1);
599 return 0;
600 }
603 return result;
604 }
virtual size_t n_rows() const
virtual size_t n_cols() const
MutableMat * makeZeroMatrix(size_t nrows, size_t ncols) const
const int ERROR
Definition m2-mem.cpp:55

References ERROR, getMat(), makeZeroMatrix(), MutableMat(), MutableMatrix::MutableMatrix(), n_cols(), n_rows(), and result().