diff --git a/testing/coxeter/APKBUILD b/testing/coxeter/APKBUILD new file mode 100644 index 00000000000..d8e0b15572c --- /dev/null +++ b/testing/coxeter/APKBUILD @@ -0,0 +1,49 @@ +# Contributor: Grigory Kirillov +# Maintainer: Grigory Kirillov +pkgname=coxeter +pkgver=3.0 +pkgrel=0 +pkgdesc="Tool for studying combinatorial aspects of Coxeter group theory" +url="http://math.univ-lyon1.fr/~ducloux/coxeter/coxeter3/english/coxeter3_e.html" +arch="all" +license="GPL-1.0-only" +source="https://archive.org/download/coxeter-$pkgver.tar.xz/coxeter-$pkgver.tar.xz + add-sagemath-interface.patch + makefile + test-input + test-output" +subpackages="$pkgname-dev $pkgname-libs" + +prepare() { + default_prepare + cp "$srcdir"/makefile . +} + +build() { + export CXXFLAGS="${CXXFLAGS/-Os/-O3}" # gotta go fast + make -e +} + +check() { + LD_LIBRARY_PATH=. ./coxeter < "$srcdir"/test-input > actual-test-output + diff "$srcdir"/test-output actual-test-output +} + +package() { + install -Dm755 coxeter "$pkgdir"/usr/bin/coxeter + install -Dm755 libcoxeter3.so.0.0.0 "$pkgdir"/usr/lib/libcoxeter3.so.0.0.0 + ln -s libcoxeter3.so.0.0.0 "$pkgdir"/usr/lib/libcoxeter3.so + install -Dm644 -t "$pkgdir"/usr/include/coxeter ./*.h ./*.hpp + install -dm755 "$pkgdir"/usr/share/coxeter + cp -vR coxeter_matrices "$pkgdir"/usr/share/coxeter/. + cp -vR headers "$pkgdir"/usr/share/coxeter/. + cp -vR messages "$pkgdir"/usr/share/coxeter/. +} + +sha512sums=" +d7702ec7f84593aa2d6290e9405494f491f4a143be6db763f2a1974baffa6ab5b4cfeec4a0699ba37a547dd20e0c991ce9753778f0fb9a8b03c3a093f6bf7ebc coxeter-3.0.tar.xz +5c76577ba110ca550756c5149067ed0c8ebfbea01888e922c826b5f919549784de7e0921cae4604221f123586b69740e677da3699f676ba40bd04fbcc0f68382 add-sagemath-interface.patch +dddce060808349d9849efd7446a139d54be8d57e2012079f96776ac85d9ef197a59d2e2c32ad950ca8cfa0cf1281d1912a31f828702edd923697cd67647f4e80 makefile +bca860dd0b717ea5cd7ba3213583f07a39f1e33451a53765db444f11a2e59a1e3d1eedb6465f6601dc67bfc30d856a793c6a05f65f53e10651509aeabebaaa91 test-input +52e7198f6ebeb05b9ddd00a280ab1e168e82f31e2124bebbac84d0bdc35096ab0caaedae7a0e58e25e1b327ed93754261254fc89a1a05589e5fd53282adc4101 test-output +" diff --git a/testing/coxeter/add-sagemath-interface.patch b/testing/coxeter/add-sagemath-interface.patch new file mode 100644 index 00000000000..1158ca46d80 --- /dev/null +++ b/testing/coxeter/add-sagemath-interface.patch @@ -0,0 +1,101 @@ +From 0c8eb9cdba9cc54415fc4f808f71f1e3e2323e85 Mon Sep 17 00:00:00 2001 +From: Jeroen Demeyer +Date: Mon, 26 Feb 2018 14:43:08 +0100 +Subject: [PATCH] Add Sage interface + +--- + sage.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + sage.h | 22 ++++++++++++++++++++++ + 2 files changed, 77 insertions(+) + create mode 100644 sage.cpp + create mode 100644 sage.h + +diff --git a/sage.cpp b/sage.cpp +new file mode 100644 +index 0000000..503654d +--- /dev/null ++++ b/sage.cpp +@@ -0,0 +1,55 @@ ++/* ++ Coxeter version 3.0 Copyright (C) 2009 Mike Hansen ++*/ ++ ++#include "sage.h" ++ ++namespace sage { ++ ++ void interval(List& list, CoxGroup& W, const CoxWord& g, const CoxWord& h) ++ ++ /* ++ Return 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 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; ++ } ++ ++} +diff --git a/sage.h b/sage.h +new file mode 100644 +index 0000000..fed0a7a +--- /dev/null ++++ b/sage.h +@@ -0,0 +1,22 @@ ++/* ++ Coxeter version 3.0 Copyright (C) 2009 Mike Hansen ++*/ ++ ++#ifndef SAGE_H /* guard against multiple inclusions */ ++#define SAGE_H ++ ++#include "globals.h" ++#include "coxgroup.h" ++#include "coxtypes.h" ++#include "schubert.h" ++#include "list.h" ++ ++namespace sage { ++ using namespace coxeter; ++ using namespace coxtypes; ++ using namespace list; ++ ++ void interval(List& result, CoxGroup& W, const CoxWord& g, const CoxWord& h); ++} ++ ++#endif diff --git a/testing/coxeter/makefile b/testing/coxeter/makefile new file mode 100644 index 00000000000..ec973192917 --- /dev/null +++ b/testing/coxeter/makefile @@ -0,0 +1,12 @@ +.POSIX: + +objects = affine.o automata.o bits.o cells.o commands.o constants.o coxgroup.o coxtypes.o error.o fcoxgroup.o files.o general.o graph.o help.o interactive.o interface.o invkl.o io.o kl.o klsupport.o main.o memory.o minroots.o posets.o sage.o schubert.o special.o transducer.o type.o typeA.o uneqkl.o wgraph.o + +coxeter: libcoxeter3.so.0.0.0 + $(CXX) $(CXXFLAGS) $(LDFLAGS) -L. -o coxeter main.o -l:libcoxeter3.so.0.0.0 + +libcoxeter3.so.0.0.0: $(objects) + $(CXX) $(CXXFLAGS) -shared -Wl,-soname=libcoxeter3.so.0.0.0 -o libcoxeter3.so.0.0.0 $(objects) + +.cpp.o: + $(CXX) $(CXXFLAGS) -fPIC -c -o $@ $< diff --git a/testing/coxeter/test-input b/testing/coxeter/test-input new file mode 100644 index 00000000000..fb732368d43 --- /dev/null +++ b/testing/coxeter/test-input @@ -0,0 +1,9 @@ +type +A +3 +compute +1 3 2 1 2 3 1 2 1 +ihbetti +213 +q +q diff --git a/testing/coxeter/test-output b/testing/coxeter/test-output new file mode 100644 index 00000000000..b97ee097be2 --- /dev/null +++ b/testing/coxeter/test-output @@ -0,0 +1,13 @@ +This is Coxeter version 3.1. +Enter help if you need assistance, carriage return to start the program. + +coxeter : +type : +rank : coxeter : enter your element (finish with a carriage return) : +213 +coxeter : enter your element (finish with a carriage return) : +h[0] = 1 h[1] = 3 h[2] = 3 h[3] = 1 + +size : 8 + +coxeter : coxeter : \ No newline at end of file