From 5c4e1eddb9d05fdf97c8d5642d5a02f92984109f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 7 Apr 2007 13:11:49 +0200 Subject: [PATCH] evalue_convert: print lattice when printing as list of polynomials --- Makefile.am | 4 ++++ evalue_convert.cc | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4864fdc..4c79de6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -112,6 +112,8 @@ barvinok_enumerate_e_SOURCES = \ barvinok_enumerate_e.cc \ evalue_convert.cc \ evalue_convert.h \ + fdstream.cc \ + fdstream.h \ verify.h \ verify.c \ verif_ehrhart.h \ @@ -123,6 +125,8 @@ barvinok_enumerate_e_LDADD = @OMEGA_LIBS@ libbarvinok.la barvinok_maximize_SOURCES = \ evalue_convert.cc \ evalue_convert.h \ + fdstream.cc \ + fdstream.h \ maximize.cc \ verify.h \ verify.c diff --git a/evalue_convert.cc b/evalue_convert.cc index 26db98d..bc5fdb2 100644 --- a/evalue_convert.cc +++ b/evalue_convert.cc @@ -1,6 +1,7 @@ #include "conversion.h" #include "evalue_convert.h" #include "lattice_point.h" +#include "fdstream.h" using std::cout; using std::cerr; @@ -168,22 +169,25 @@ static void evalue_print_list_evalue(FILE *out, evalue *e, int nparam, if (!L) print_evalue(out, e, params); else { + fdostream os(dup(fileno(out))); Vector *coset = Vector_Alloc(nparam+1); value_set_si(coset->p[nparam], 1); mat_ZZ RT; mat_ZZ R; matrix2zz(L, RT, nparam, nparam); R = transpose(RT); + fprintf(out, "Lattice:\n"); + os << R << endl; mat_ZZ vertices; lattice_point(coset->p, R, vertices, to_ulong(abs(determinant(R))), NULL); Matrix_Free(L); for (int i = 0; i < vertices.NumRows(); ++i) { evalue t; - cout << vertices[i] << endl; + os << vertices[i] << endl; zz2values(vertices[i], coset->p); value_init(t.d); evalue_coset(e, coset, &t); - print_evalue(stdout, &t, params); + print_evalue(out, &t, params); free_evalue_refs(&t); } Vector_Free(coset); -- 2.11.4.GIT