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

◆ IM2_Matrix_get_entry()

const RingElement * IM2_Matrix_get_entry ( const Matrix * M,
int r,
int c )

Definition at line 55 of file matrix.cpp.

58{
59 try
60 {
61 if (r < 0 || r >= M->n_rows())
62 {
63 ERROR("matrix row index %d out of range 0 .. %d", r, M->n_rows() - 1);
64 return nullptr;
65 }
66 if (c < 0 || c >= M->n_cols())
67 {
68 ERROR("matrix column index %d out of range 0 .. %d",
69 c,
70 M->n_cols() - 1);
71 return nullptr;
72 }
74 result = M->elem(r, c);
76 } catch (const exc::engine_error& e)
77 {
78 ERROR(e.what());
79 return nullptr;
80 }
81}
const Ring * get_ring() const
Definition matrix.hpp:134
ring_elem elem(int i, int j) const
Definition matrix.cpp:307
int n_cols() const
Definition matrix.hpp:147
int n_rows() const
Definition matrix.hpp:146
static RingElement * make_raw(const Ring *R, ring_elem f)
Definition relem.cpp:20
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)

References Matrix::elem(), ERROR, Matrix::get_ring(), RingElement::make_raw(), Matrix, Matrix::n_cols(), Matrix::n_rows(), and result().