summaryrefslogtreecommitdiff
path: root/math/coxeter3/files/patch-sage.cpp
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2021-01-24 17:25:34 +0000
committerThierry Thomas <thierry@FreeBSD.org>2021-01-24 17:25:34 +0000
commitdd30b03275d7b7760bd38191f1d075840b60e949 (patch)
tree17fc0fe50e54316d2ae444f05dc9fdea802e9798 /math/coxeter3/files/patch-sage.cpp
parentHook drm-fbsd13-kmod to the maser drm-kmod port and bump its PORTREVISION. (diff)
Add Coxeter3, a llibrary for the study of combinatorial aspects of Coxeter group
theory, to be used by SageMath 9.3.
Notes
Notes: svn path=/head/; revision=562493
Diffstat (limited to 'math/coxeter3/files/patch-sage.cpp')
-rw-r--r--math/coxeter3/files/patch-sage.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/math/coxeter3/files/patch-sage.cpp b/math/coxeter3/files/patch-sage.cpp
new file mode 100644
index 000000000000..e77896ba2233
--- /dev/null
+++ b/math/coxeter3/files/patch-sage.cpp
@@ -0,0 +1,63 @@
+--- sage.cpp.orig 2021-01-24 16:21:00 UTC
++++ sage.cpp
+@@ -0,0 +1,60 @@
++/*
++ Coxeter version 3.0 Copyright (C) 2009 Mike Hansen
++ See file main.cpp for full copyright notice
++
++ Patch from Jeroen Demeyer <jdemeyer@cage.ugent.be>,
++ borrowed by SageMath: Add Sage interface.
++
++*/
++
++#include "sage.h"
++
++namespace sage {
++
++ void interval(List<CoxWord>& list, CoxGroup& W, const CoxWord& g, const CoxWord& h)
++
++ /*
++ Returns a list of the elements in the Bruhat interval between g and h.
++ Note that this assumes that g and h are in order.
++ */
++ {
++ if (not W.inOrder(g,h)) {
++ return;
++ }
++
++ W.extendContext(h);
++
++ CoxNbr x = W.contextNumber(g);
++ CoxNbr y = W.contextNumber(h);
++
++ BitMap b(W.contextSize());
++ W.extractClosure(b,y);
++
++ BitMap::ReverseIterator b_rend = b.rend();
++ List<CoxNbr> res(0);
++
++ for (BitMap::ReverseIterator i = b.rbegin(); i != b_rend; ++i)
++ if (not W.inOrder(x,*i)) {
++ BitMap bi(W.contextSize());
++ W.extractClosure(bi,*i);
++ CoxNbr z = *i; // andnot will invalidate iterator
++ b.andnot(bi);
++ b.setBit(z); // otherwise the decrement will not be correct
++ } else
++ res.append(*i);
++
++ schubert::NFCompare nfc(W.schubert(),W.ordering());
++ Permutation a(res.size());
++ sortI(res,nfc,a);
++
++ list.setSize(0);
++ for (size_t j = 0; j < res.size(); ++j) {
++ CoxWord w(0);
++ W.schubert().append(w, res[a[j]]);
++ list.append(w);
++ }
++
++ return;
++ }
++
++}