From 9a09a9ba040a8a7d455f715da7842ee7ca750acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pernet?= Date: Fri, 16 Nov 2018 13:24:15 +0100 Subject: [PATCH 1/2] remove sage binding --- configure.ac | 2 - interfaces/Makefile.am | 3 +- interfaces/sage/Makefile.am | 42 -------- interfaces/sage/linbox-sage.C | 175 ---------------------------------- interfaces/sage/linbox-sage.h | 65 ------------- macros/sage-check.m4 | 65 ------------- 6 files changed, 1 insertion(+), 351 deletions(-) delete mode 100644 interfaces/sage/Makefile.am delete mode 100644 interfaces/sage/linbox-sage.C delete mode 100644 interfaces/sage/linbox-sage.h delete mode 100644 macros/sage-check.m4 diff --git a/configure.ac b/configure.ac index bb5c5e5fb5..ec233a1d96 100644 --- a/configure.ac +++ b/configure.ac @@ -258,7 +258,6 @@ LB_CHECK_NTL LB_CHECK_SACLIB LB_CHECK_MAPLE -LB_CHECK_SAGE LB_CHECK_EXPAT @@ -338,7 +337,6 @@ interfaces/Makefile interfaces/driver/Makefile interfaces/maple/Makefile interfaces/kaapi/Makefile -interfaces/sage/Makefile macros/Makefile macros/CodeChunk/Makefile benchmarks/Makefile diff --git a/interfaces/Makefile.am b/interfaces/Makefile.am index 73f5f5bbe1..79b0783747 100644 --- a/interfaces/Makefile.am +++ b/interfaces/Makefile.am @@ -19,7 +19,6 @@ -SUBDIRS=driver kaapi maple sage - +SUBDIRS=driver kaapi maple diff --git a/interfaces/sage/Makefile.am b/interfaces/sage/Makefile.am deleted file mode 100644 index a8b384d901..0000000000 --- a/interfaces/sage/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2010 the LinBox group -# ========LICENCE======== -# This file is part of the library LinBox. -# -# LinBox is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# ========LICENCE======== - - - -if LINBOX_HAVE_SAGE - -#AM_CPPFLAGS=-I$(top_srcdir) -I. -I../../linbox - -AM_CPPFLAGS = -DDISABLE_COMMENTATOR -I$(top_srcdir) $(DEPS_CFLAGS) $(DEFAULT_CFLAGS) -LDADD = $(DEPS_LIBS) $(LDFLAGS) - -#AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(NTL_CFLAGS) $(OPTFLAGS) $(PARFLAGS) - -lib_LTLIBRARIES = liblinboxsage.la - -liblinboxsage_la_SOURCES = linbox-sage.C - -pkginclude_HEADERS = linbox-sage.h - -#liblinboxsage_la_LIBADD = -llinbox -#gentoo's linbox-1.1.6-fix-undefined-symbols.patch -liblinboxsage_la_LIBADD = $(top_builddir)/linbox/liblinbox.la - -liblinboxsage_la_LDFLAGS = $(DEPS_LIBS) $(LDFLAGS) $(LINBOX_LDFLAGS) -version-info 0:0:0 #-Wl,-zmuldefs -endif diff --git a/interfaces/sage/linbox-sage.C b/interfaces/sage/linbox-sage.C deleted file mode 100644 index 4c8caf236a..0000000000 --- a/interfaces/sage/linbox-sage.C +++ /dev/null @@ -1,175 +0,0 @@ -/* linbox-sage.C - * Copyright (C) 2007 Martin Albrecht - * 2008 Clement Pernet - * - * Written by Martin Albrecht - * Clement Pernet - * - * ========LICENCE======== - * This file is part of the library LinBox. - * - * LinBox is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * ========LICENCE======== - */ - -#include - -#include -#include -#include -#include "linbox/linbox-config.h" -#include "linbox/util/commentator.h" - -#include "linbox/matrix/sparse-matrix.h" -#include "linbox/vector/sparse.h" - -#include "linbox/matrix/matrix-domain.h" -#include "linbox/algorithms/gauss.h" -#include "linbox/solutions/rank.h" -#include "linbox/solutions/solve.h" -#include "linbox/solutions/methods.h" -#include "linbox/integer.h" - -#include - -#include "linbox-sage.h" - -using namespace LinBox; - - -/************************************************************************* - sparse modulo Z/nZ - *************************************************************************/ - -struct c_vector_modint_linbox { - // copy of the declaration in vector_modn_sparse.pxi - int *entries; - int p; - size_t *positions; - size_t degree; - size_t num_nonzero; -}; - -typedef unsigned int mod_int; -typedef Givaro::Modular GFp; -typedef GFp::Element GFpElement; -typedef std::vector > SparseSeqVectorGFp; -typedef SparseMatrix::SparseFormat> SparseMatrixGFp; - -SparseMatrixGFp* linbox_new_modn_sparse_matrix(mod_int modulus, size_t numrows, size_t numcols, void *rows) -{ - GFp *F=new GFp(modulus); - SparseMatrixGFp* M=new SparseMatrixGFp(*F, numrows, numcols); - - struct c_vector_modint_linbox *A = static_cast(rows); - - for(size_t i = 0; i < numrows; ++i) { - for(size_t j = 0; j < A[i].num_nonzero; ++j) { - M->setEntry(i, A[i].positions[j], A[i].entries[j]); - } - } - return M; -} - -void linbox_delete_modn_sparse_matrix (SparseMatrixGFp * A) { - const GFp * F = &A->field(); - delete A; - delete F; -} - -static std::vector linbox_new_modn_sparse_vector(mod_int modulus, size_t len, void *_vec) -{ - std::vector A(len); - - if (_vec==NULL) { - return A; - } - - struct c_vector_modint_linbox *vec = static_cast(_vec); - for(size_t i = 0; i < vec->num_nonzero; ++i) { - A[vec->positions[i]] = vec->entries[i]; - } - return A; -} - -unsigned long linbox_modn_sparse_matrix_rank(mod_int modulus, - size_t numrows, size_t numcols, - void *rows, int gauss) -{ - unsigned long M_rank; - GFpElement M_det; - - SparseMatrixGFp *M = linbox_new_modn_sparse_matrix(modulus, numrows, numcols, rows) ; - const GFp &F = M->field(); - GaussDomain dom(F); - - if(!gauss) { - dom.InPlaceLinearPivoting(M_rank, M_det, *M, numrows, numcols); - } - else { - dom.NoReordering(M_rank, M_det, *M, numrows, numcols); - } - - //*pivots = (int*)calloc(sizeof(int), dom.pivots.size()); - - // int j=0; - // for(std::vector::const_iterator i= dom.pivots.begin(); i!= dom.pivots.end(); ++i, ++j){ - // (*pivots)[j] = *i; - // } - linbox_delete_modn_sparse_matrix(M); - return M_rank; -} - -std::vector linbox_modn_sparse_matrix_solve(mod_int p, size_t numrows, size_t numcols, - void *_a, void *b, int method) -{ - // solve ax = b, for x, a matrix, b vector, x vector - - SparseMatrixGFp *A =linbox_new_modn_sparse_matrix(p, numrows, numcols, _a); - - const GFp & F = A->field(); - - DenseVector X(F, numrows); - DenseVector B(F, linbox_new_modn_sparse_vector(p, numcols, b) ); - - switch(method) { - case 1: - solve(X, *A, B, Method::BlasElimination()); - break; - - case 2: - solve(X, *A, B, Method::Blackbox()); - break; - - case 3: - solve(X, *A, B, Method::Wiedemann()); - break; - - default: - solve(X, *A, B); - } - - linbox_delete_modn_sparse_matrix(A); - - return X.refRep(); -} - -// Local Variables: -// mode: C++ -// tab-width: 4 -// indent-tabs-mode: nil -// c-basic-offset: 4 -// End: -// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s diff --git a/interfaces/sage/linbox-sage.h b/interfaces/sage/linbox-sage.h deleted file mode 100644 index e7aaa4c957..0000000000 --- a/interfaces/sage/linbox-sage.h +++ /dev/null @@ -1,65 +0,0 @@ -/* linbox-sage.h - * Copyright (C) 2007 Martin Albrecht - * 2008 Clement Pernet - * - * Written by Martin Albrecht - * Clement Pernet - * - * ========LICENCE======== - * This file is part of the library LinBox. - * - * LinBox is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * ========LICENCE======== - */ - -#ifndef __LINBOX_sage_H -#define __LINBOX_sage_H - -#include - -#include -#include - -#ifdef __cplusplus -#define EXTERN extern "C" -#else -#define EXTERN -#endif -/***************************************************************** - - Sparse over Z/nZ - -*****************************************************************/ - - -unsigned long linbox_modn_sparse_matrix_rank(unsigned int modulus, - size_t numrows, - size_t numcols, - void *rows, - int reorder); - -std::vector linbox_modn_sparse_matrix_solve (unsigned int modulus, size_t numrows, - size_t numcols, void *a, void *b, - int method); - -#endif // __LINBOX_SAGE_H - -// Local Variables: -// mode: C++ -// tab-width: 4 -// indent-tabs-mode: nil -// c-basic-offset: 4 -// End: -// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s diff --git a/macros/sage-check.m4 b/macros/sage-check.m4 deleted file mode 100644 index 1652f6df65..0000000000 --- a/macros/sage-check.m4 +++ /dev/null @@ -1,65 +0,0 @@ -dnl Copyright (c) the LinBox group -dnl This file is part of LinBox - - dnl ========LICENCE======== - dnl This file is part of the library LinBox. - dnl - dnl LinBox is free software: you can redistribute it and/or modify - dnl it under the terms of the GNU Lesser General Public - dnl License as published by the Free Software Foundation; either - dnl version 2.1 of the License, or (at your option) any later version. - dnl - dnl This library is distributed in the hope that it will be useful, - dnl but WITHOUT ANY WARRANTY; without even the implied warranty of - dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - dnl Lesser General Public License for more details. - dnl - dnl You should have received a copy of the GNU Lesser General Public - dnl License along with this library; if not, write to the Free Software - dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - dnl ========LICENCE======== - dnl - - -AC_DEFUN([LB_CHECK_SAGE], -[ -AC_MSG_CHECKING([whether to compile the SAGE interface]) - -AC_ARG_ENABLE(sage, -[AC_HELP_STRING([--enable-sage], [Enable the compilation of the SAGE interface])]) -AM_CONDITIONAL(LINBOX_HAVE_SAGE, test "x$enable_sage" = "xyes") - -AS_IF([test "x$enable_sage" = "xyes"], -[ -AC_MSG_RESULT(yes) -AC_DEFINE(HAVE_SAGE,1,[Define if SageMath interface is built]) -LINBOXSAGE_LIBS="-llinboxsage" -dnl if test "x$HAVE_NTL" = "xyes" ; then - dnl AC_CHECK_TOOL(OBJDUMP, objdump, false) - dnl AC_MSG_CHECKING([whether NTL was built with -fPIC]) - dnl res=yes; - dnl if test -f "$NTL_HOME/lib/libntl.a" ; then - dnl $OBJDUMP --reloc $NTL_HOME/lib/libntl.a | $EGREP '(GOT|PLT|JU?MP_SLOT)' >/dev/null || res=no - dnl else if test -f "$NTL_HOME/lib/libntl.so" ; then - dnl $OBJDUMP -R $NTL_HOME/lib/libntl.so | $EGREP '(GOT|PLT|JU?MP_SLOT)' >/dev/null || res=no - dnl else - dnl AC_MSG_RESULT(no, libntl not found !) - dnl fi - dnl fi - - dnl if test "x$res" = "xno" ; then - dnl AC_MSG_RESULT(no) - dnl echo - dnl echo "You must have NTL compiled with -fPIC for Sage interface " - dnl dnl exit 1 - dnl else - dnl AC_MSG_RESULT(yes) - dnl fi -dnl fi - -],[ -AC_MSG_RESULT(no) -LINBOXSAGE_LIBS="" -]) -]) -AC_SUBST(LINBOXSAGE_LIBS) From 512d27e8fa8507dbd696414d467e921bd1090d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pernet?= Date: Mon, 3 Dec 2018 15:12:17 +0100 Subject: [PATCH 2/2] remove sage from auto-install script --- linbox-auto-install.sh | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/linbox-auto-install.sh b/linbox-auto-install.sh index 1a42bf6142..dbec8d7263 100755 --- a/linbox-auto-install.sh +++ b/linbox-auto-install.sh @@ -54,8 +54,6 @@ EXTRA="" EXTRA_VAR="" IML="--with-iml" IML_VAR="" -SAGE="" -SAGE_VAR="false" DRIV="" DRIV_VAR="false" OPENBLAS="" @@ -131,8 +129,6 @@ help() { echo " Default : disabled. May be \'full\' " echo " --enable-optimization : build with compile-time optimization." echo " Default : enabled." - echo " --enable-sage : build with sage support." - echo " Default : disabled." echo " --enable-drivers : build with drivers support." echo " Default : disabled." echo @@ -241,21 +237,11 @@ for i in "$@" ; do IML="$i " IML_VAR="true" ;; - "--enable-sage") - if [ "x$SAGE_VAR" = "xfalse" ] ; then echo "enable-sage or not ?"; help ; exit -1; fi - SAGE="$i" - SAGE_VAR="true" - ;; "--enable-drivers") if [ "x$DRIV_VAR" = "xfalse" ] ; then echo "enable-drivers or not ?" ; help ; exit -1; fi DRIV="$i" DRIV_VAR="true" ;; - "--disable-sage") - if [ "x$SAGE_VAR" = "xtrue" ] ; then echo "enable-sage or not ?"; help ; exit -1; fi - SAGE="" - SAGE_VAR="false" - ;; "--disable-drivers") if [ "x$DRIV_VAR" = "xtrue" ] ; then echo "enable-drivers or not ?" ; help ; exit -1; fi DRIV="" @@ -379,16 +365,6 @@ for i in "$@" ; do CHECK_VAR="false" fi ;; - "--enable-sage") - [[ "$QUOI" =~ y|yes|Y|1 ]] && OK=1 || OK=0 - if [ "x$SAGE_VAR" = "xtrue" -a "OK" = "0" ] ; then echo "sage or not sage ?" ; help ; exit -1; fi - if [ "x$SAGE_VAR" = "xfalse" -a "OK" = "1" ] ; then echo "sage or not sage ?" ; help ; exit -1; fi - if [[ "x$OK" = "x1" ]] ; then - SAGE=$QUI ; SAGE_VAR="true" - else - SAGE_VAR="false" - fi - ;; "--enable-drivers") [[ "$QUOI" =~ y|yes|Y|1 ]] && OK=1 || OK=0 if [ "x$OPTIM_VAR" = "xtrue" -a "OK" = "0" ] ; then echo "drivers or not drivers ?" ; help ; exit -1; fi @@ -859,12 +835,12 @@ echo -e " * to ensure you don't get undefined symbols !"| tee -a ./auto-install. echo ""| tee -a ./auto-install.log if [ -x autogen.sh ] ; then - echo "./autogen.sh $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $SAGE $DRIV"| tee -a ./auto-install.log - ./autogen.sh "$PREFIX" "$DEBUG" "$OPTIM" "$GMP" "$BLAS" "$NTL" "$WARNINGS" "$IML" "$SAGE" "$DRIV" | tee -a ./auto-install.log|| die + echo "./autogen.sh $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $DRIV"| tee -a ./auto-install.log + ./autogen.sh "$PREFIX" "$DEBUG" "$OPTIM" "$GMP" "$BLAS" "$NTL" "$WARNINGS" "$IML" "$DRIV" | tee -a ./auto-install.log|| die else - echo "./configure $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $SAGE $DRIV"| tee -a ./auto-install.log - # ./configure $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $SAGE $DRIV || die - ./configure "$PREFIX" "$DEBUG" "$OPTIM" "$GMP" "$BLAS" "$NTL" "$WARNINGS" "$IML" "$SAGE" "$DRIV" | tee -a ./auto-install.log|| die + echo "./configure $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $DRIV"| tee -a ./auto-install.log + # ./configure $PREFIX $DEBUG $OPTIM $GMP $BLAS $NTL $WARNINGS $IML $DRIV || die + ./configure "$PREFIX" "$DEBUG" "$OPTIM" "$GMP" "$BLAS" "$NTL" "$WARNINGS" "$IML" "$DRIV" | tee -a ./auto-install.log|| die fi echo -e "${BEG}building LinBox..."| tee -a ./auto-install.log