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

◆ is_valid_partition()

bool SchurRing2::is_valid_partition ( M2_arrayint part,
bool set_error = true ) const

Definition at line 157 of file schur2.cpp.

158{
159 if (nvars >= 0 && part->len > nvars)
160 {
161 if (set_error) ERROR("expected a partition of size at most %d\n", nvars);
162 return false;
163 }
164 for (int i = 1; i < part->len; i++)
165 if (part->array[i - 1] < part->array[i])
166 {
167 if (set_error) ERROR("expected a non-increasing sequence of integers");
168 return false;
169 }
170 if (part->len > 0 && part->array[part->len - 1] < 0)
171 {
172 if (set_error) ERROR("expected nonnegative integers only");
173 return false;
174 }
175 return true;
176}
const int ERROR
Definition m2-mem.cpp:55

References ERROR, and nvars.

Referenced by rawSchurFromPartition().