Date: Sunday, April 1, 2018 @ 11:10:31 Author: arojas Revision: 313722
Add Sage fork of coxeter library Added: coxeter/ coxeter/trunk/ coxeter/trunk/PKGBUILD coxeter/trunk/coxeter-makefile.patch coxeter/trunk/coxeter-sage.patch ------------------------+ PKGBUILD | 37 +++++++++++++++++ coxeter-makefile.patch | 99 +++++++++++++++++++++++++++++++++++++++++++++++ coxeter-sage.patch | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) Added: coxeter/trunk/PKGBUILD =================================================================== --- coxeter/trunk/PKGBUILD (rev 0) +++ coxeter/trunk/PKGBUILD 2018-04-01 11:10:31 UTC (rev 313722) @@ -0,0 +1,37 @@ +# Maintainer: Antonio Rojas <aro...@archlinux.org> + +pkgname=coxeter +pkgver=git.20180226 +pkgrel=1 +_commit=7b5a1f0039511326aeb616afb132a5065886b9d8 +pkgdesc="A library for the study of combinatorial aspects of Coxeter group theory" +arch=(x86_64) +url="https://github.com/tscrim/coxeter" +license=(GPL3) +depends=(gcc-libs) +makedepends=(git) +conflicts=(coxeter3) +source=("git+https://github.com/tscrim/coxeter#commit=$_commit" coxeter-sage.patch coxeter-makefile.patch) +sha256sums=('SKIP' + '668235f7858c4542d2856d6b36f2f1d18f14ffea685a96637992a14613a71688' + '237403a2f668fea18aebee4d1bde9697cd44b5e3836f34452cfc9f401932465f') + +prepare() { + cd coxeter +# Add Sage patches + patch -p1 -i ../coxeter-sage.patch + patch -p1 -i ../coxeter-makefile.patch +} + +build() { + cd coxeter + + make all +} + +package() { + cd coxeter + mkdir -p "$pkgdir"/usr/{lib,bin} + make SAGE_LOCAL="$pkgdir/usr" install +} + Added: coxeter/trunk/coxeter-makefile.patch =================================================================== --- coxeter/trunk/coxeter-makefile.patch (rev 0) +++ coxeter/trunk/coxeter-makefile.patch 2018-04-01 11:10:31 UTC (rev 313722) @@ -0,0 +1,99 @@ +diff -druN src/makefile src/makefile +--- src/makefile 2013-02-14 18:26:28.000000000 +0100 ++++ src/makefile 2013-02-15 14:34:54.082756900 +0100 +@@ -12,6 +12,7 @@ + gflags = -c $(includedirs) -g + + cflags = $(gflags) # the default setting ++cflags = -c $(includedirs) -O2 -fPIC -g + + ifdef optimize + NDEBUG = true +@@ -22,18 +23,74 @@ + cflags = $(pflags) + endif + +-cc = g++ ++EXENAME = coxeter ++LIBNAME = coxeter3 ++ifeq ($(UNAME),Darwin) ++ EXEEXT = ++ LIBPREFIX = lib ++ LIBEXT = .dylib ++ LIBDIR = lib ++ LINKFLAGS = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,3.0,-current_version,3.0,-install_name,$(SAGE_LOCAL)/lib/$(LIBPREFIX)$(LIBNAME)$(LIBEXT) ++ LINKLIBS = ++else ++ifeq ($(UNAME),CYGWIN) ++ EXEEXT = .exe ++ LIBPREFIX = cyg ++ LIBEXT = .dll ++ LIBDIR = bin ++ IMPLIB = lib$(LIBNAME).dll.a ++ LINKFLAGS = -shared -Wl,--out-implib=$(IMPLIB) -Wl,--export-all-symbols ++ LINKLIBS = -lc ++else ++ EXEEXT = ++ LIBPREFIX = lib ++ LIBEXT = .so ++ LIBDIR = lib ++ LINKFLAGS = -shared -Wl,-soname,libcoxeter3.so ++ LINKLIBS = -lc ++endif ++endif ++LIBRARY = $(LIBPREFIX)$(LIBNAME)$(LIBEXT) + +-all: coxeter #clean ++all: coxeter executable + + coxeter: $(objects) +- $(cc) -o coxeter $(objects) ++ $(CXX) $(LINKFLAGS) -o $(LIBRARY) $(objects) $(LINKLIBS) ++ ++executable: $(objects) ++ $(CXX) -o $(EXENAME)$(EXEEXT) $(objects) ++ ++DATADIR="$$SAGE_LOCAL/share/coxeter/" ++INCLUDEDIR="$$SAGE_LOCAL/include/coxeter/" ++LIBRARYDIR="$$SAGE_LOCAL/$(LIBDIR)" ++ ++install: coxeter executable ++ cp $(EXENAME)$(EXEEXT) "$$SAGE_LOCAL/bin/" ++ cp $(LIBRARY) $(LIBRARYDIR) ++ if [ $(UNAME) = "CYGWIN" ]; then \ ++ cp $(IMPLIB) "$$SAGE_LOCAL/lib/"; \ ++ fi ++ ++ mkdir -p $(DATADIR) ++ cp -r coxeter_matrices headers messages $(DATADIR) ++ mkdir -p $(INCLUDEDIR) ++ cp -r *.h *.hpp $(INCLUDEDIR) ++ ++check: coxeter executable ++ $(EXENAME)$(EXEEXT) < test.input > test.output ++ ++ if ! diff test.output.expected test.output > /dev/null; then \ ++ echo >&2 "Error testing coxeter on test.input:"; \ ++ diff test.output.expected test.output; \ ++ exit 1; \ ++ fi ++ rm -f test.output + + clean: + rm -f $(objects) + + %.o:%.cpp +- $(cc) $(cflags) $*.cpp ++ $(CXX) $(cflags) $*.cpp + + # dependencies --- these were generated automatically by make depend on my + # system; they are explicitly copied for portability. Only local dependencies +@@ -43,7 +100,7 @@ + # contents of tmp in lieu of the dependencies listed here. + + %.d:%.cpp +- @$(cc) -MM $*.cpp ++ @$(CXX) -MM $*.cpp + depend: $(dependencies) + + affine.o: affine.cpp affine.h globals.h coxgroup.h coxtypes.h io.h list.h \ Added: coxeter/trunk/coxeter-sage.patch =================================================================== --- coxeter/trunk/coxeter-sage.patch (rev 0) +++ coxeter/trunk/coxeter-sage.patch 2018-04-01 11:10:31 UTC (rev 313722) @@ -0,0 +1,99 @@ +See https://github.com/tscrim/coxeter/pull/14 + +commit 7b46d5ea88cfdcaa4af549f61c58c330fb513948 +Author: Jeroen Demeyer <jdeme...@cage.ugent.be> +Date: Mon Feb 26 14:43:08 2018 +0100 + + Add Sage interface + +diff --git a/sage.cpp b/sage.cpp +new file mode 100644 +index 0000000..74f86be +--- /dev/null ++++ b/sage.cpp +@@ -0,0 +1,56 @@ ++/* ++ Coxeter version 3.0 Copyright (C) 2009 Mike Hansen ++ See file main.cpp for full copyright notice ++*/ ++ ++#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; ++ } ++ ++} +diff --git a/sage.h b/sage.h +new file mode 100644 +index 0000000..5b3df8a +--- /dev/null ++++ b/sage.h +@@ -0,0 +1,23 @@ ++/* ++ Coxeter version 3.0 Copyright (C) 2009 Mike Hansen ++ See file main.cpp for full copyright notice ++*/ ++ ++#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<CoxWord>& result, CoxGroup& W, const CoxWord& g, const CoxWord& h); ++} ++ ++#endif