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

◆ is_homogeneous()

bool Matrix::is_homogeneous ( ) const

Definition at line 332 of file matrix.cpp.

333{
334 auto R = get_ring();
335 auto D = R->degree_monoid();
336 if (!R->is_graded()) return 0;
337 monomial d = D->make_one();
338 for (int i = 0; i < n_cols(); i++)
339 {
340 if (elem(i) == nullptr) continue;
341 if (!R->vec_is_homogeneous(rows(), elem(i)))
342 {
343 D->remove(d);
344 return 0;
345 }
346
347 R->vec_multi_degree(rows(), elem(i), d);
348 D->divide(d, degree_shift(), d);
349 if (0 != D->compare(d, cols()->degree(i)))
350 {
351 D->remove(d);
352 return 0;
353 }
354 }
355 D->remove(d);
356 return 1;
357}
const_monomial degree_shift() const
Definition matrix.hpp:149
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
const FreeModule * rows() const
Definition matrix.hpp:144
const FreeModule * cols() const
Definition matrix.hpp:145
#define monomial
Definition gb-toric.cpp:11

References cols(), degree_shift(), elem(), get_ring(), is_homogeneous(), monomial, n_cols(), and rows().

Referenced by createF4GB(), IM2_Matrix_is_graded(), and is_homogeneous().