Skip to content

Commit

Permalink
Made NTL interface work, fixed lots of build system errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbhart committed Dec 22, 2011
1 parent 6865686 commit 0103ccb
Show file tree
Hide file tree
Showing 35 changed files with 385 additions and 42 deletions.
24 changes: 15 additions & 9 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ examples: all $(LOBJS) library
check: $(FLINT_LIB)
ifndef MOD
mkdir -p build/test
mkdir -p build/interfaces/test
$(foreach prog, $(TESTS), $(CC) $(CFLAGS) $(INCS) $(prog).c -o build/$(prog) $(LIBS);)
$(foreach prog, $(TESTS), build/$(prog);)
$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir)/test; export BUILD_DIR=../build/$(dir); $(MAKE) -C $(dir) check;)
if [ "$(WANT_NTL)" -eq "1" ]; then \
$(CXX) $(CFLAGS) $(INCS) interfaces/test/t-NTL-interface.cpp build/interfaces/NTL-interface.o -o build/interfaces/test/t-NTL-interface $(LIBS) -lntl; \
build/interfaces/test/t-NTL-interface; \
fi
else
$(foreach dir, $(MOD), mkdir -p build/$(dir)/test; export BUILD_DIR=../build/$(dir); $(MAKE) -C $(dir) check;)
endif
Expand All @@ -75,16 +80,17 @@ library: library-recursive $(OBJS) $(LIB_OBJS)
$(CXX) -fPIC $(CFLAGS) $(INCS) -c interfaces/NTL-interface.cpp -o build/interfaces/NTL-interface.lo; \
fi; \
if [ "$(FLINT_STATIC)" -eq "1" ]; then \
$(CXX) -fPIC $(CFLAGS) $(INCS) -c interfaces/NTL-interface.cpp -o build/interfaces/NTL-interface.o; \
$(CXX) -fPIC $(CFLAGS) $(INCS) -c interfaces/NTL-interface.cpp -o build/interfaces/NTL-interface.o; \
fi; \
fi
if [ "$(FLINT_SHARED)" -eq "1" ]; then \
$(CC) -fPIC -shared $(LIB_OBJS) $(LIBS2) -o $(FLINT_LIB); \
$(CC) -fPIC -shared $(LIB_OBJS) $(LIBS2) -o $(FLINT_LIB); \
fi
if [ "$(FLINT_STATIC)" -eq "1" ]; then \
$(AR) rcs libflint.a $(OBJS) $(LINKLIBS); \
$(AR) rcs libflint.a $(OBJS) $(LINKLIBS); \
fi


library-recursive:
if [ "$(FLINT_STATIC)" -eq "1" ]; then \
$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir); export BUILD_DIR=../build/$(dir); $(MAKE) -C $(dir);) \
Expand All @@ -98,12 +104,12 @@ $(FLINT_LIB): library
install: library
mkdir -p $(PREFIX)/lib
mkdir -p $(PREFIX)/include
ifdef FLINT_SHARED
cp $(FLINT_LIB) $(PREFIX)/lib
endif
ifdef FLINT_STATIC
cp libflint.a $(PREFIX)/lib
endif
if [ "$(FLINT_SHARED)" -eq "1" ]; then \
cp $(FLINT_LIB) $(PREFIX)/lib;
fi
if [ "$(FLINT_STATIC)" -eq "1" ]; then \
cp libflint.a $(PREFIX)/lib;
fi
cp *.h $(PREFIX)/include

.PHONY: profile library library-recursive recursive clean check check-recursive all
Expand Down
6 changes: 0 additions & 6 deletions NTL-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,13 @@ extern "C" {
#include <NTL/ZZ.h>
#include <NTL/ZZX.h>
#include <NTL/vec_ZZ.h>
#include <NTL/mat_ZZ.h>

#include "flint.h"
#include "fmpz.h"
#include "fmpz_poly.h"

NTL_CLIENT

/*
Returns the number of limbs taken up by an NTL ZZ.
*/
mp_size_t ZZ_limbs(const ZZ& op);

/*
Converts an NTL ZZ to an fmpz_t.
Expand Down
8 changes: 8 additions & 0 deletions arith.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "fmpq_poly.h"
#include "fmpq.h"

#ifdef __cplusplus
extern "C" {
#endif

void fmpz_primorial(fmpz_t res, long n);

void fmpz_poly_ramanujan_tau(fmpz_poly_t res, long n);
Expand Down Expand Up @@ -268,4 +272,8 @@ void mpfr_const_euler_brent_mcmillan(mpfr_t res, mpfr_rnd_t rnd);

void mpfr_zeta_ui_bsplit(mpfr_t x, ulong s, mpfr_rnd_t rnd);

#ifdef __cplusplus
}
#endif

#endif
14 changes: 3 additions & 11 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,9 @@ CFLAGS="$CFLAGS $FLINT_TUNE"

echo "# This file is autogenerated by ./configure -- do not edit!" > Makefile
echo "" >> Makefile
if [ "$STATIC" -eq "1" ]; then
echo "FLINT_STATIC=1" >> Makefile
fi
if [ "$SHARED" -eq "1" ]; then
echo "FLINT_SHARED=1" >> Makefile
fi
if [ "$WANT_NTL" -eq "1" ]; then
echo "WANT_NTL=1" >> Makefile
echo "OBJ_EXTRAS="build/interfaces/NTL-interface.o" >> Makefile
echo "LIB_EXTRAS="build/interfaces/NTL-interface.lo" >> Makefile
fi
echo "FLINT_STATIC=$STATIC" >> Makefile
echo "FLINT_SHARED=$SHARED" >> Makefile
echo "WANT_NTL=$WANT_NTL" >> Makefile
echo "FLINT_MPIR_LIB_DIR=$MPIR_LIB_DIR" >> Makefile
echo "FLINT_MPIR_INCLUDE_DIR=$MPIR_INCLUDE_DIR" >> Makefile
echo "FLINT_MPFR_LIB_DIR=$MPFR_LIB_DIR" >> Makefile
Expand Down
8 changes: 8 additions & 0 deletions flint.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <mpfr.h>
#include "longlong.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
We define alternative key words for "asm" and "inline", allowing
the code to be compiled with the "-ansi" flag under GCC
Expand Down Expand Up @@ -165,5 +169,9 @@ unsigned int FLINT_BIT_COUNT(mp_limb_t x)
(xxx)[ixxx] = yyy; \
} while (0)

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions fmpq.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include "fmpz.h"
#include "fmpz_vec.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
fmpz num;
Expand Down Expand Up @@ -334,4 +338,8 @@ void fmpq_bsplit_sum_abpq(fmpq_bsplit_t s,
void fmpq_bsplit_sum_abcdpq(fmpq_bsplit_t s,
const fmpq * ab, const fmpq * cd, const fmpq * pq, long n1, long n2);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fmpq_mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "fmpz_mat.h"
#include "fmpq.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
fmpq * entries;
Expand Down Expand Up @@ -178,4 +182,8 @@ long fmpq_mat_rref_fraction_free(long * perm, fmpq_mat_t B, const fmpq_mat_t A);

long fmpq_mat_rref(long * perm, fmpq_mat_t B, const fmpq_mat_t A);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fmpq_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "fmpz_vec.h"
#include "fmpz_poly.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Type definitions ********************************************************/

typedef struct
Expand Down Expand Up @@ -653,5 +657,9 @@ int fmpq_poly_read(fmpq_poly_t poly)
return fmpq_poly_fread(stdin, poly);
}

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions fmpz.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "flint.h"
#include "nmod_vec.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef long fmpz;
typedef fmpz fmpz_t[1];

Expand Down Expand Up @@ -590,5 +594,9 @@ fmpz_set_ui_mod(fmpz_t f, mp_limb_t x, mp_limb_t m)
fmpz_set_si(f, x - m);
}

#ifdef __cplusplus
}
#endif

#endif

2 changes: 2 additions & 0 deletions fmpz/randbits.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ fmpz_randbits(fmpz_t f, flint_rand_t state, mp_bitcnt_t bits)

if (n_randint(state, 2))
mpz_neg(mpz_ptr, mpz_ptr);

_fmpz_demote_val(f);
}
}
8 changes: 8 additions & 0 deletions fmpz_factor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "flint.h"
#include "fmpz.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
int sign;
Expand Down Expand Up @@ -72,4 +76,8 @@ void fmpz_factor_expand_multiexp(fmpz_t n, const fmpz_factor_t factor);

void fmpz_factor_expand(fmpz_t n, const fmpz_factor_t factor);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fmpz_mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "fmpz.h"
#include "nmod_mat.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
fmpz * entries;
Expand Down Expand Up @@ -272,5 +276,9 @@ void fmpz_mat_CRT_ui(fmpz_mat_t res, const fmpz_mat_t mat1,
void fmpz_mat_CRT_ui_unsigned(fmpz_mat_t res, const fmpz_mat_t mat1,
const fmpz_t m1, const nmod_mat_t mat2);

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions fmpz_mod_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "fmpz.h"
#include "fmpz_poly.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Type definitions *********************************************************/

typedef struct
Expand Down Expand Up @@ -428,5 +432,9 @@ int fmpz_mod_poly_print_pretty(const fmpz_mod_poly_t poly, const char * x)
return fmpz_mod_poly_fprint_pretty(stdout, poly, x);
}

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions fmpz_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#include "fmpz_vec.h"
#include "nmod_poly.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Type definitions *********************************************************/

typedef struct
Expand Down Expand Up @@ -894,4 +898,8 @@ void
fmpz_poly_interpolate_fmpz_vec(fmpz_poly_t poly,
const fmpz * xs, const fmpz * ys, long n);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fmpz_poly_mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "fmpz_mat.h"
#include "fmpz_poly.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Types *********************************************************************/

typedef struct
Expand Down Expand Up @@ -205,4 +209,8 @@ void fmpz_poly_mat_solve_fflu_precomp(fmpz_poly_mat_t X,
const long * perm,
const fmpz_poly_mat_t FFLU, const fmpz_poly_mat_t B);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions fmpz_poly_q.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "fmpz.h"
#include "fmpz_poly.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
fmpz_poly_struct *num;
Expand Down Expand Up @@ -170,5 +174,9 @@ char * fmpz_poly_q_get_str_pretty(const fmpz_poly_q_t op, const char *x);
int fmpz_poly_q_print(const fmpz_poly_q_t op);
int fmpz_poly_q_print_pretty(const fmpz_poly_q_t op, const char *x);

#ifdef __cplusplus
}
#endif

#endif

8 changes: 8 additions & 0 deletions fmpz_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <mpir.h>
#include "fmpz.h"

#ifdef __cplusplus
extern "C" {
#endif

#define FMPZ_VEC_NORM(vec, i) \
do { \
while ((i) && vec[(i) - 1] == 0L) \
Expand Down Expand Up @@ -192,5 +196,9 @@ void _fmpz_vec_content(fmpz_t res, const fmpz * vec, long len);

void _fmpz_vec_lcm(fmpz_t res, const fmpz * vec, long len);

#ifdef __cplusplus
}
#endif

#endif

Loading

0 comments on commit 0103ccb

Please sign in to comment.