Macaulay2 Engine
Loading...
Searching...
No Matches
monomDL.cpp
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright (C) 2006-2011 by Mikhail V. Zinin *
3 * mzinin@gmail.com *
4 * *
5 * You may redistribute this file under the terms of the GNU General *
6 * Public License as published by the Free Software Foundation, either *
7 * version 2 of the License, or any later version. *
8 *****************************************************************************/
9
10#include <M2/config.h>
11#ifdef HAVE_STDDEF_H
12#include <stddef.h>
13#endif
14#include "monomDL.hpp"
15
16namespace BIBasis
17{
18 int MonomDL::Compare(const MonomDL& anotherMonom)
19 {
20 if (TotalDegree < anotherMonom.TotalDegree)
21 {
22 return -1;
23 }
24 else if (TotalDegree > anotherMonom.TotalDegree)
25 {
26 return 1;
27 }
28 else
29 {
30 VarsListNode *iterator(ListHead),
31 *iteratorAnother(anotherMonom.ListHead);
32 while (iterator)
33 {
34 if (iterator->Value < iteratorAnother->Value)
35 {
36 return 1;
37 }
38 if (iterator->Value > iteratorAnother->Value)
39 {
40 return -1;
41 }
42 iterator = iterator->Next;
43 iteratorAnother = iteratorAnother->Next;
44 }
45 return 0;
46 }
47 }
48
50}
Slab allocator handing out fixed-size blocks for one BIBasis type per instance.
Definition allocator.hpp:57
Integer TotalDegree
Definition monom.hpp:106
VarsListNode * ListHead
Definition monom.hpp:105
int Compare(const MonomDL &anotherMonom)
Definition monomDL.cpp:18
static FastAllocator Allocator
Definition monomDL.hpp:62
Monom specialisation that orders monomials by degree, then by lex on the variable list (DegLex).
Definition monomDL.hpp:60
BIBasis::MonomDL — degree-lex specialisation of the BIBasis monomial type.
Singly linked-list node of a Monom's variable list, with a per-class slab allocator.
Definition monom.hpp:94