Macaulay2 Engine
Loading...
Searching...
No Matches
monomLex.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 "monomLex.hpp"
15
16namespace BIBasis
17{
18 int MonomLex::Compare(const MonomLex& anotherMonom)
19 {
20 VarsListNode *iterator = ListHead,
21 *iteratorAnother = anotherMonom.ListHead;
22 while (iterator && iteratorAnother)
23 {
24 if (iterator->Value < iteratorAnother->Value)
25 {
26 return 1;
27 }
28 if (iterator->Value > iteratorAnother->Value)
29 {
30 return -1;
31 }
32 iterator = iterator->Next;
33 iteratorAnother = iteratorAnother->Next;
34 }
35
36 if (iterator)
37 {
38 return 1;
39 }
40 else if (iteratorAnother)
41 {
42 return -1;
43 }
44 else
45 {
46 return 0;
47 }
48 }
49
51}
Slab allocator handing out fixed-size blocks for one BIBasis type per instance.
Definition allocator.hpp:57
VarsListNode * ListHead
Definition monom.hpp:105
int Compare(const MonomLex &anotherMonom)
Definition monomLex.cpp:18
static FastAllocator Allocator
Definition monomLex.hpp:65
Monom specialisation that orders monomials by pure lex on their sorted variable lists.
Definition monomLex.hpp:63
BIBasis::MonomLex — pure lexicographic 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