[SCM] givaro: library for arithmetic and algebraic computations branch, upstream, updated. upstream/3.4.2-1-g69d49ba

Lifeng Sun lifongsun at gmail.com
Fri Jun 8 15:21:51 UTC 2012


The following commit has been merged in the upstream branch:
commit 69d49ba21cccc3d222161fdd873c1229ca64d544
Author: Lifeng Sun <lifongsun at gmail.com>
Date:   Fri Jun 8 21:15:57 2012 +0800

    Imported Upstream version 3.7.0

diff --git a/INSTALL b/INSTALL
index 7d1c323..6dea44e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,365 +1,2 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-
-   Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.  This file is offered as-is,
-without warranty of any kind.
-
-Basic Installation
-==================
-
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.  Some packages provide this
-`INSTALL' file but do not implement all of the features documented
-below.  The lack of an optional feature in a given package is not
-necessarily a bug.  More recommendations for GNU packages can be found
-in *note Makefile Conventions: (standards)Makefile Conventions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-   The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.
-
-     Running `configure' might take a while.  While running, it prints
-     some messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package, generally using the just-built uninstalled binaries.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.  When installing into a prefix owned by root, it is
-     recommended that the package be configured and built as a regular
-     user, and only the `make install' phase executed with root
-     privileges.
-
-  5. Optionally, type `make installcheck' to repeat any self-tests, but
-     this time using the binaries in their final installed location.
-     This target does not install anything.  Running this target as a
-     regular user, particularly if the prior `make install' required
-     root privileges, verifies that the installation completed
-     correctly.
-
-  6. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-  7. Often, you can also type `make uninstall' to remove the installed
-     files again.  In practice, not all packages have tested that
-     uninstallation works correctly, even though it is required by the
-     GNU Coding Standards.
-
-  8. Some packages, particularly those that use Automake, provide `make
-     distcheck', which can by used by developers to test that all other
-     targets like `make install' and `make uninstall' work correctly.
-     This target is generally not run by end users.
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  Run `./configure --help'
-for details on some of the pertinent environment variables.
-
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
-
-     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
-   *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you can use GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.  This
-is known as a "VPATH" build.
-
-   With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory.  After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
-   On MacOS X 10.5 and later systems, you can create libraries and
-executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor.  Like
-this:
-
-     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-                 CPP="gcc -E" CXXCPP="g++ -E"
-
-   This is not guaranteed to produce working output in all cases, you
-may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
-
-Installation Names
-==================
-
-   By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
-absolute file name.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.  In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
-specifications that were not explicitly provided.
-
-   The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
-both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
-having to reconfigure or recompile.
-
-   The first method involves providing an override variable for each
-affected directory.  For example, `make install
-prefix=/alternate/directory' will choose an alternate location for all
-directory configuration variables that were expressed in terms of
-`${prefix}'.  Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated.  The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
-   The second method involves providing the `DESTDIR' variable.  For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names.  The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
-does not work on platforms that have drive letters.  On the other hand,
-it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
-
-Optional Features
-=================
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-   Some packages offer the ability to configure how verbose the
-execution of `make' will be.  For these packages, running `./configure
---enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
---disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
-
-Particular systems
-==================
-
-   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
-CC is not installed, it is recommended to use the following options in
-order to use an ANSI C compiler:
-
-     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
-
-and if that doesn't work, install pre-built binaries of GCC for HP-UX.
-
-   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
-a workaround.  If GNU CC is not installed, it is therefore recommended
-to try
-
-     ./configure CC="cc"
-
-and if that doesn't work, try
-
-     ./configure CC="cc -nodtk"
-
-   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
-directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
-
-   On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'.  It is recommended to use the following options:
-
-     ./configure --prefix=/boot/common
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on.  Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
-     CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
-     OS
-     KERNEL-OS
-
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
-   If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
-   If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-   Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
-
-     ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug.  Until the bug is fixed you can use this workaround:
-
-     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--help'
-`-h'
-     Print a summary of all of the options to `configure', and exit.
-
-`--help=short'
-`--help=recursive'
-     Print a summary of the options unique to this package's
-     `configure', and exit.  The `short' variant lists options used
-     only in the top level, while the `recursive' variant lists options
-     also present in any nested packages.
-
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`--cache-file=FILE'
-     Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
-     disable caching.
-
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--prefix=DIR'
-     Use DIR as the installation prefix.  *note Installation Names::
-     for more details, including other options available for fine-tuning
-     the installation locations.
-
-`--no-create'
-`-n'
-     Run the configure checks, but stop before creating any output
-     files.
-
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.
-
+make ; make install should be good enough.
+Don't forget to configure with --prefix so your installation goes to the intented location !
diff --git a/Makefile.am b/Makefile.am
index 75d5ad5..2a39172 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,11 +40,15 @@ DISTCLEANFILES = src/kernel/system/givaro   \
 				 src/library/tools/givaro   \
 				 src/library/vector/givaro
 
+uninstall-hook:
+	(test -d "$(includedir)/givaro" && rmdir "$(includedir)/givaro") || true
+	(test -d "$(includedir)/gmp++" && rmdir "$(includedir)/gmp++") || true
 
-# docs_dev:docs/givaro-dev-html/index.html
 
-#  doc/givaro-dev-html/index.html:
-#  (cd docs; make docs_dev)
+docs_dev:docs/givaro-dev-html/index.html
 
-VERSION=3.4.2
+docs/givaro-dev-html/index.html:
+	(cd docs; make docs_dev)
+
+VERSION=3.7.0
 
diff --git a/Makefile.in b/Makefile.in
index 137d19b..c23a8f8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -47,7 +65,8 @@ DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
 	$(srcdir)/givaro-makefile.in $(top_srcdir)/configure AUTHORS \
 	COPYING ChangeLog INSTALL NEWS build-aux/config.guess \
 	build-aux/config.sub build-aux/install-sh build-aux/ltmain.sh \
-	build-aux/missing
+	build-aux/missing config.guess config.sub install-sh ltmain.sh \
+	missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
@@ -66,8 +85,35 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = givaro-config givaro-makefile
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"
-binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(bin_SCRIPTS)
 depcomp =
 am__depfiles_maybe =
@@ -80,28 +126,58 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-includeHEADERS_INSTALL = $(INSTALL_HEADER)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 HEADERS = $(include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir dist dist-all distcheck
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -132,6 +208,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -167,6 +244,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -174,12 +252,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 TESTS_CFLAGS = @TESTS_CFLAGS@
-
-# docs_dev:docs/givaro-dev-html/index.html
-
-#  doc/givaro-dev-html/index.html:
-#  (cd docs; make docs_dev)
-VERSION = 3.4.2
+VERSION = 3.7.0
 WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -256,21 +329,21 @@ all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
-am--refresh:
+am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu  --ignore-deps'; \
-	      cd $(srcdir) && $(AUTOMAKE) --gnu  --ignore-deps \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps \
 		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -286,21 +359,20 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
 	$(SHELL) ./config.status --recheck
 
 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	cd $(srcdir) && $(AUTOCONF)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
 
 config.h: stamp-h1
-	@if test ! -f $@; then \
-	  rm -f stamp-h1; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
-	else :; fi
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	cd $(top_builddir) && $(SHELL) ./config.status config.h
 $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
-	cd $(top_srcdir) && $(AUTOHEADER)
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
 
@@ -312,23 +384,39 @@ givaro-makefile: $(top_builddir)/config.status $(srcdir)/givaro-makefile.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 install-binSCRIPTS: $(bin_SCRIPTS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  if test -f $$d$$p; then \
-	    f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
-	    echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
-	    $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
-	  else :; fi; \
-	done
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	     } \
+	; done
 
 uninstall-binSCRIPTS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(bin_SCRIPTS)'; for p in $$list; do \
-	  f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
-	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
-	done
+	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -340,21 +428,25 @@ distclean-libtool:
 	-rm -f libtool config.lt
 install-includeHEADERS: $(include_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
-	@list='$(include_HEADERS)'; for p in $$list; do \
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
-	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
 	done
 
 uninstall-includeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(include_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
-	done
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -380,7 +472,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -414,16 +506,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -438,7 +530,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -450,7 +542,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@@ -459,36 +551,41 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
-	test -d $(distdir) || mkdir $(distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -504,51 +601,72 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
 	done
-	-find "$(distdir)" -type d ! -perm -755 \
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
 		-exec chmod u+rwx,go+rx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
-	|| chmod -R a+r $(distdir)
+	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
 	$(am__remove_distdir)
 
 dist-lzma: distdir
 	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
 	$(am__remove_distdir)
 
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	$(am__remove_distdir)
+
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
@@ -572,15 +690,19 @@ dist dist-all: distdir
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
-	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
@@ -588,10 +710,13 @@ distcheck: dist
 	mkdir $(distdir)/_build
 	mkdir $(distdir)/_inst
 	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-	  && cd $(distdir)/_build \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -612,14 +737,24 @@ distcheck: dist
 	  && rm -rf "$$dc_destdir" \
 	  && $(MAKE) $(AM_MAKEFLAGS) dist \
 	  && rm -rf $(DIST_ARCHIVES) \
-	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
 	$(am__remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@cd $(distuninstallcheck_dir) \
-	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -653,16 +788,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
@@ -737,26 +878,29 @@ ps: ps-recursive
 ps-am:
 
 uninstall-am: uninstall-binSCRIPTS uninstall-includeHEADERS
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+	@$(NORMAL_INSTALL)
+	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+	ctags-recursive install-am install-strip tags-recursive \
+	uninstall-am
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
-	distclean distclean-generic distclean-hdr distclean-libtool \
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binSCRIPTS install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-includeHEADERS install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs installdirs-am maintainer-clean \
+	dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
+	dist-zip distcheck distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-binSCRIPTS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am \
+	install-includeHEADERS install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-am uninstall-binSCRIPTS \
+	uninstall uninstall-am uninstall-binSCRIPTS uninstall-hook \
 	uninstall-includeHEADERS
 
 
@@ -769,6 +913,16 @@ docs/givaro-html/index.html:
 
 examples:
 	(cd examples; make examples)
+
+uninstall-hook:
+	(test -d "$(includedir)/givaro" && rmdir "$(includedir)/givaro") || true
+	(test -d "$(includedir)/gmp++" && rmdir "$(includedir)/gmp++") || true
+
+docs_dev:docs/givaro-dev-html/index.html
+
+docs/givaro-dev-html/index.html:
+	(cd docs; make docs_dev)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/aclocal.m4 b/aclocal.m4
index bf13095..4e6bc0d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.10.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.5 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -13,28 +14,31 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.10'
+[am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10.3], [],
+m4_if([$1], [1.11.5], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,19 +54,21 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.5])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -110,14 +116,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 8
+# serial 9
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
@@ -130,6 +136,7 @@ AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
 if $2; then
   $1_TRUE=
   $1_FALSE='#'
@@ -143,14 +150,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 12
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -190,6 +197,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -254,7 +262,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -319,10 +327,13 @@ AC_DEFUN([AM_DEP_TRACK],
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -426,7 +437,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 13
+# serial 16
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -443,7 +454,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.60])dnl
+[AC_PREREQ([2.62])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -503,24 +514,37 @@ AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-	      		     [_AM_PROG_TAR([v7])])])
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-                  [_AM_DEPENDENCIES(CC)],
-                  [define([AC_PROG_CC],
-                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-                  [_AM_DEPENDENCIES(CXX)],
-                  [define([AC_PROG_CXX],
-                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-                  [_AM_DEPENDENCIES(OBJC)],
-                  [define([AC_PROG_OBJC],
-                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
 ])
 
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
 
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
@@ -543,18 +567,28 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
 AC_SUBST(install_sh)])
 
 # Copyright (C) 2003, 2005  Free Software Foundation, Inc.
@@ -581,27 +615,38 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
 AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
-  dnl maintainer-mode is disabled by default
-  AC_ARG_ENABLE(maintainer-mode,
-[  --enable-maintainer-mode  enable make rules and dependencies not useful
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer],
-      USE_MAINTAINER_MODE=$enableval,
-      USE_MAINTAINER_MODE=no)
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
-  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
   MAINT=$MAINTAINER_MODE_TRUE
-  AC_SUBST(MAINT)dnl
+  AC_SUBST([MAINT])dnl
 ]
 )
 
@@ -609,14 +654,14 @@ AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
@@ -633,7 +678,14 @@ AC_SUBST($1)])
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
   am_missing_run="$MISSING --run "
@@ -643,12 +695,15 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -671,13 +726,14 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -685,13 +741,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -704,14 +760,14 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # AM_SANITY_CHECK
 # ---------------
@@ -720,16 +776,29 @@ AC_DEFUN([AM_SANITY_CHECK],
 # Just in case
 sleep 1
 echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
 # Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    if test "$[*]" = "X"; then
       # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
+      set X `ls -t "$srcdir/configure" conftest.file`
    fi
    rm -f conftest.file
    if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -754,12 +823,14 @@ Check your system clock])
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -782,21 +853,28 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 3
+
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -818,10 +896,11 @@ AC_DEFUN([_AM_SUBST_NOTMAKE])
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
 m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 40eaed4..a3b0d66 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -2,9 +2,9 @@
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2011-05-11'
+timestamp='2012-02-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2011-05-11'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -57,8 +55,8 @@ GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -140,12 +138,35 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU/*)
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#ifdef __UCLIBC__
+	# ifdef __UCLIBC_CONFIG_VERSION__
+	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
+	# else
+	LIBC=uclibc
+	# endif
+	#else
+	# ifdef __dietlibc__
+	LIBC=dietlibc
+	# else
+	LIBC=gnu
+	# endif
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -792,13 +813,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -807,6 +827,9 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
 	# uname -m includes "-pc" on this system.
 	echo ${UNAME_MACHINE}-mingw32
@@ -852,15 +875,22 @@ EOF
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -872,56 +902,51 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     frv:Linux:*:*)
-	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -940,54 +965,54 @@ EOF
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1315,6 +1340,9 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 30fdca8..42adc67 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,9 +2,9 @@
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2011-03-23'
+timestamp='2012-02-10'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@ timestamp='2011-03-23'
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -76,8 +74,8 @@ version="\
 GNU config.sub ($timestamp)
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -132,6 +130,10 @@ case $maybe_os in
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -247,17 +249,22 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx \
+	| d10v | d30v | dlx | dsp16xx | dvp \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -291,7 +298,7 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -300,7 +307,7 @@ case $basic_machine in
 	| spu \
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -315,8 +322,7 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -329,7 +335,10 @@ case $basic_machine in
 	strongarm | thumb | xscale)
 		basic_machine=arm-unknown
 		;;
-
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
 	xscaleeb)
 		basic_machine=armeb-unknown
 		;;
@@ -352,11 +361,13 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -365,8 +376,10 @@ case $basic_machine in
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -400,7 +413,7 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -408,10 +421,11 @@ case $basic_machine in
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile-* | tilegx-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -711,7 +725,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -787,6 +800,24 @@ case $basic_machine in
 		basic_machine=m68k-atari
 		os=-mint
 		;;
+	mipsEE* | ee | ps2)
+		basic_machine=mips64r5900el-scei
+		case $os in
+		    -linux*)
+			;;
+		    *)
+			os=-elf
+			;;
+		esac
+		;;
+	iop)
+		basic_machine=mipsel-scei
+		os=-irx
+		;;
+	dvp)
+		basic_machine=dvp-scei
+		os=-elf
+		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -808,10 +839,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -1120,13 +1159,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	# This must be matched before tile*.
-	tilegx*)
-		basic_machine=tilegx-unknown
-		os=-linux-gnu
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1336,13 +1370,13 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -irx* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
@@ -1548,9 +1582,6 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
diff --git a/build-aux/install-sh b/build-aux/install-sh
index 6781b98..a9244eb 100755
--- a/build-aux/install-sh
+++ b/build-aux/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for `test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -200,7 +208,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for `test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
index 6f650ae..b395ba7 100755
--- a/build-aux/ltmain.sh
+++ b/build-aux/ltmain.sh
@@ -69,7 +69,7 @@
 #         compiler:		$LTCC
 #         compiler flags:		$LTCFLAGS
 #         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4 Debian-2.4-2
+#         $progname:	(GNU libtool) 2.4
 #         automake:	$automake_version
 #         autoconf:	$autoconf_version
 #
@@ -79,7 +79,7 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4 Debian-2.4-2"
+VERSION=2.4
 TIMESTAMP=""
 package_revision=1.3293
 
@@ -5643,7 +5643,8 @@ func_mode_link ()
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
@@ -6111,10 +6112,7 @@ func_mode_link ()
 	case $pass in
 	dlopen) libs="$dlfiles" ;;
 	dlpreopen) libs="$dlprefiles" ;;
-	link)
-	  libs="$deplibs %DEPLIBS%"
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-	  ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 	esac
       fi
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
@@ -6150,7 +6148,8 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
@@ -6433,19 +6432,19 @@ func_mode_link ()
 	    # It is a libtool convenience library, so add in its objects.
 	    func_append convenience " $ladir/$objdir/$old_library"
 	    func_append old_convenience " $ladir/$objdir/$old_library"
-	    tmp_libs=
-	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-	      if $opt_preserve_dup_deps ; then
-		case "$tmp_libs " in
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
-		esac
-	      fi
-	      func_append tmp_libs " $deplib"
-	    done
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done
 	  continue
 	fi # $pass = conv
 
@@ -7337,9 +7336,6 @@ func_mode_link ()
 	    revision="$number_minor"
 	    lt_irix_increment=no
 	    ;;
-	  *)
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
-	    ;;
 	  esac
 	  ;;
 	no)
diff --git a/build-aux/missing b/build-aux/missing
index 28055d2..86a8fc3 100755
--- a/build-aux/missing
+++ b/build-aux/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-01-06.13; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -84,7 +84,6 @@ Supported PROGRAM values:
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -122,15 +121,6 @@ case $1 in
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
   *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
@@ -226,7 +216,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -256,7 +246,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -318,41 +308,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
diff --git a/build-aux/config.guess b/config.guess
similarity index 94%
copy from build-aux/config.guess
copy to config.guess
index 40eaed4..a3b0d66 100755
--- a/build-aux/config.guess
+++ b/config.guess
@@ -2,9 +2,9 @@
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2011-05-11'
+timestamp='2012-02-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2011-05-11'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -57,8 +55,8 @@ GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -140,12 +138,35 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU/*)
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#ifdef __UCLIBC__
+	# ifdef __UCLIBC_CONFIG_VERSION__
+	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
+	# else
+	LIBC=uclibc
+	# endif
+	#else
+	# ifdef __dietlibc__
+	LIBC=dietlibc
+	# else
+	LIBC=gnu
+	# endif
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -792,13 +813,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -807,6 +827,9 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
 	# uname -m includes "-pc" on this system.
 	echo ${UNAME_MACHINE}-mingw32
@@ -852,15 +875,22 @@ EOF
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -872,56 +902,51 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     frv:Linux:*:*)
-	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -940,54 +965,54 @@ EOF
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1315,6 +1340,9 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/config.h.in b/config.h.in
index d4d560d..ed4ce83 100644
--- a/config.h.in
+++ b/config.h.in
@@ -82,6 +82,9 @@
 /* Define to 1 if the system has the type `_Bool'. */
 #undef HAVE__BOOL
 
+/* Define if you want most code inlined */
+#undef INLINE_ALL
+
 /* Canonical 16-bit data type */
 #undef INT16
 
diff --git a/build-aux/config.sub b/config.sub
similarity index 96%
copy from build-aux/config.sub
copy to config.sub
index 30fdca8..42adc67 100755
--- a/build-aux/config.sub
+++ b/config.sub
@@ -2,9 +2,9 @@
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2011-03-23'
+timestamp='2012-02-10'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@ timestamp='2011-03-23'
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -76,8 +74,8 @@ version="\
 GNU config.sub ($timestamp)
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -132,6 +130,10 @@ case $maybe_os in
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -247,17 +249,22 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx \
+	| d10v | d30v | dlx | dsp16xx | dvp \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -291,7 +298,7 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -300,7 +307,7 @@ case $basic_machine in
 	| spu \
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -315,8 +322,7 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -329,7 +335,10 @@ case $basic_machine in
 	strongarm | thumb | xscale)
 		basic_machine=arm-unknown
 		;;
-
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
 	xscaleeb)
 		basic_machine=armeb-unknown
 		;;
@@ -352,11 +361,13 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -365,8 +376,10 @@ case $basic_machine in
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -400,7 +413,7 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -408,10 +421,11 @@ case $basic_machine in
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile-* | tilegx-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -711,7 +725,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -787,6 +800,24 @@ case $basic_machine in
 		basic_machine=m68k-atari
 		os=-mint
 		;;
+	mipsEE* | ee | ps2)
+		basic_machine=mips64r5900el-scei
+		case $os in
+		    -linux*)
+			;;
+		    *)
+			os=-elf
+			;;
+		esac
+		;;
+	iop)
+		basic_machine=mipsel-scei
+		os=-irx
+		;;
+	dvp)
+		basic_machine=dvp-scei
+		os=-elf
+		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -808,10 +839,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -1120,13 +1159,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	# This must be matched before tile*.
-	tilegx*)
-		basic_machine=tilegx-unknown
-		os=-linux-gnu
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1336,13 +1370,13 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -irx* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
@@ -1548,9 +1582,6 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
diff --git a/configure b/configure
index 370ec49..7f57daf 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for Givaro 3.4.2.
+# Generated by GNU Autoconf 2.69 for Givaro 3.7.0.
 #
 # Report bugs to <Jean-Guillaume.Dumas at imag.fr>.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -136,6 +134,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -222,21 +246,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -339,6 +367,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -460,6 +496,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -494,16 +534,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -515,28 +555,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -570,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Givaro'
 PACKAGE_TARNAME='givaro'
-PACKAGE_VERSION='3.4.2'
-PACKAGE_STRING='Givaro 3.4.2'
+PACKAGE_VERSION='3.7.0'
+PACKAGE_STRING='Givaro 3.7.0'
 PACKAGE_BUGREPORT='Jean-Guillaume.Dumas at imag.fr'
 PACKAGE_URL='http://ljk.imag.fr/CASYS/LOGICIELS/givaro'
 
@@ -611,9 +631,13 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='LTLIBOBJS
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
 GIVARO_BUILD_DOC_FALSE
 GIVARO_BUILD_DOC_TRUE
+GIVARO_DOXYGEN_FOUND_FALSE
+GIVARO_DOXYGEN_FOUND_TRUE
 GIVARO_DOC_PATH
 GMP_VERSION
 GMP_LIBS
@@ -663,14 +687,19 @@ CPPFLAGS
 LDFLAGS
 CXXFLAGS
 CXX
+GIVARO_INLINE_ALL
+GIVARO_INLINE_ALL_FALSE
+GIVARO_INLINE_ALL_TRUE
 WARN
-WARNINGS_FALSE
-WARNINGS_TRUE
+PROF
+PROFILE_FALSE
+PROFILE_TRUE
 DBG
 DEBUG_FALSE
 DEBUG_TRUE
 INSIDE_GNOME_COMMON_FALSE
 INSIDE_GNOME_COMMON_TRUE
+am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -745,7 +774,9 @@ enable_option_checking
 enable_maintainer_mode
 enable_dependency_tracking
 enable_debug
+enable_profile
 enable_warnings
+enable_inline
 enable_shared
 enable_static
 with_pic
@@ -756,7 +787,7 @@ enable_libtool_lock
 with_gmp
 with_docdir
 with_doxygen
-enable_docs
+enable_doc
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1225,8 +1256,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1312,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Givaro 3.4.2 to adapt to many kinds of systems.
+\`configure' configures Givaro 3.7.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1382,7 +1411,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Givaro 3.4.2:";;
+     short | recursive ) echo "Configuration of Givaro 3.7.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1395,7 +1424,14 @@ Optional Features:
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-debug          enable debugging options in library
-  --enable-warnings       enable warings when compiling the library
+  --enable-profile        enable profiling options in library
+  --enable-warnings=yes|full|no
+                          enable warnings when compiling the library. If
+                          nothing or yes is given, more aggressive compiler
+                          warnings are passed to the compiler. If full is
+                          given, we become paranoïd about warnings and treat
+                          them as errors.
+  --enable-inline         enable inlining most of the code
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1501,10 +1537,10 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Givaro configure 3.4.2
-generated by GNU Autoconf 2.68
+Givaro configure 3.7.0
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1697,7 +1733,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1841,7 +1877,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2089,7 +2125,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2105,7 +2142,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2131,7 +2169,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2147,7 +2186,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2181,7 +2221,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2253,8 +2294,8 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Givaro $as_me 3.4.2, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by Givaro $as_me 3.7.0, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2631,7 +2672,7 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
 ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
-am__api_version='1.10'
+am__api_version='1.11'
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2670,7 +2711,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2731,16 +2772,29 @@ $as_echo_n "checking whether build environment is sane... " >&6; }
 # Just in case
 sleep 1
 echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
 # Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    if test "$*" = "X"; then
       # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
+      set X `ls -t "$srcdir/configure" conftest.file`
    fi
    rm -f conftest.file
    if test "$*" != "X $srcdir/configure conftest.file" \
@@ -2778,7 +2832,14 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
   am_missing_run="$MISSING --run "
@@ -2788,7 +2849,14 @@ else
 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
 
 # Installed binaries are usually stripped using `strip' when the user
 # run `make install-strip'.  However `strip' might not be the right
@@ -2812,7 +2880,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2852,7 +2920,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2903,7 +2971,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
 	     'mkdir (GNU coreutils) '* | \
 	     'mkdir (coreutils) '* | \
@@ -2956,7 +3024,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3042,7 +3110,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='givaro'
- VERSION='3.4.2'
+ VERSION='3.7.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3072,11 +3140,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
 
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
@@ -3084,8 +3152,6 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 ac_config_headers="$ac_config_headers config.h"
 
-ac_config_headers="$ac_config_headers "
-
 
 ac_config_commands="$ac_config_commands givaro-config.h"
 
@@ -3107,7 +3173,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3133,6 +3199,7 @@ fi
 RM="$RM -f"
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
     # Check whether --enable-maintainer-mode was given.
@@ -3163,6 +3230,7 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3202,6 +3270,8 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
+echo "-----------------------------------------------"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debugging options in the library" >&5
 $as_echo_n "checking whether to enable debugging options in the library... " >&6; }
   # Check whether --enable-debug was given.
@@ -3224,7 +3294,28 @@ fi
   DBG=$USE_DEBUG
 
 
-# AC_FULL_DEBUG
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable profiling everything in the library" >&5
+$as_echo_n "checking whether to enable profiling everything in the library... " >&6; }
+  # Check whether --enable-profile was given.
+if test "${enable_profile+set}" = set; then :
+  enableval=$enable_profile; USE_PROFILE=$enableval
+else
+  USE_PROFILE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_PROFILE" >&5
+$as_echo "$USE_PROFILE" >&6; }
+   if test $USE_PROFILE = yes; then
+  PROFILE_TRUE=
+  PROFILE_FALSE='#'
+else
+  PROFILE_TRUE='#'
+  PROFILE_FALSE=
+fi
+
+  PROF=$USE_PROFILE
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable warnings when compiling the library" >&5
 $as_echo_n "checking whether to enable warnings when compiling the library... " >&6; }
   # Check whether --enable-warnings was given.
@@ -3236,18 +3327,37 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_WARNINGS" >&5
 $as_echo "$USE_WARNINGS" >&6; }
-   if test $USE_WARNINGS = yes; then
-  WARNINGS_TRUE=
-  WARNINGS_FALSE='#'
+    WARN=$USE_WARNINGS
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to inline or not most of the code ?" >&5
+$as_echo_n "checking whether to inline or not most of the code ?... " >&6; }
+  # Check whether --enable-inline was given.
+if test "${enable_inline+set}" = set; then :
+  enableval=$enable_inline; USE_INLINE=$enableval
+
+$as_echo "#define INLINE_ALL 1" >>confdefs.h
+
+else
+  USE_INLINE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_INLINE" >&5
+$as_echo "$USE_INLINE" >&6; }
+   if test $USE_INLINE = yes; then
+  GIVARO_INLINE_ALL_TRUE=
+  GIVARO_INLINE_ALL_FALSE='#'
 else
-  WARNINGS_TRUE='#'
-  WARNINGS_FALSE=
+  GIVARO_INLINE_ALL_TRUE='#'
+  GIVARO_INLINE_ALL_FALSE=
 fi
 
-  WARN=$USE_WARNINGS
 
+  echo $GIVARO_INLINE_ALL
 
 
+
+echo "-----------------------------------------------"
+
 # CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
 # CXXFLAGS=${CXXFLAGS:-$DEFAULT_CXXFLAGS}
 
@@ -3255,6 +3365,7 @@ fi
 # Try and pass different flags according to compiler #
 ######################################################
 
+
 # disable default -g -O2 CXXFLAGS
 : ${CXXFLAGS=""}
 
@@ -3287,7 +3398,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3331,7 +3442,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3769,60 +3880,89 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for family name of compiler" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for family name of compiler" >&5
 $as_echo_n "checking for family name of compiler... " >&6; }
-if test "$cross_compiling" = yes; then :
-
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
-$as_echo "unknown" >&6; }
-   CCNAM=unknown
-
 
+						if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-   #ifdef __INTEL_COMPILER
+
+           #ifdef __INTEL_COMPILER
    int main() { return 0 ; }
    #else
    pas intel
-   #endif
+		   #endif
 _ACEOF
 if ac_fn_cxx_try_run "$LINENO"; then :
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: icc" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: icc" >&5
 $as_echo "icc" >&6; }
    CCNAM=icc
 
 
-else
-     if test "$cross_compiling" = yes; then :
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
-$as_echo "unknown" >&6; }
-   CCNAM=unknown
 
+		if  test -z "${CCNAM}"; then :
 
+			if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __GNUC__
-   int main() { return 0 ; }
-   #else
-   pas gcc non plus.
-   #endif
+
+				#ifdef __PATHSCALE__
+				   int main() { return !(__PATHCC__ >= 4) ; }
+			   #else
+				   pas ekopath non plus.
+				#endif
 _ACEOF
 if ac_fn_cxx_try_run "$LINENO"; then :
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: gcc" >&5
-$as_echo "gcc" >&6; }
-   CCNAM=gcc
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: eko" >&5
+$as_echo "eko" >&6; }
+		CCNAM=eko
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
 
+fi
+
+		if  test -z "${CCNAM}"; then :
+
+			if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
 else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
-$as_echo "unknown" >&6; }
-   CCNAM=unknown
+				#ifdef __clang__
+				   int main() { return !(__clang_major >=3) ; }
+			   #else
+				   pas clang non plus.
+				#endif
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: clang" >&5
+$as_echo "clang" >&6; }
+		CCNAM=clang
 
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -3831,48 +3971,100 @@ fi
 
 
 fi
+
+		if  test -z "${CCNAM}"; then :
+
+			if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+				#ifdef __GNUC__
+				   int main() { return !(__GNUC__ >= 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) ; }
+   #else
+				   pas gcc non plus ???
+				#endif
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+		CCNOM=gcc
+		if  test -n "${CC}" ; then :
+  CCNOM="`$CC --version 2>&1|  awk 'NR<2{print }'`"
+fi
+   CCNAM=gcc
+
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCNOM" >&5
+$as_echo "$CCNOM" >&6; }
+
+fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
+fi
+
+
+		if  test -z "${CCNAM}"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+   CCNAM=unknown
+
+				echo
+				echo " *** unknow compiler. please file a bug "
+				echo
+
+fi
+
 
 
 
 
 
-TESTS_CFLAGS="-O0 -g"
+TESTS_CFLAGS="-O0"
 DEBUG_CFLAGS="-g"
 DEFAULT_CFLAGS="-pipe"
 WARN_CFLAGS="-Wall"
 
 if test "x$DBG" = "xyes" ; then
-	DEFAULT_CFLAGS="-O0 ${DEFAULT_CFLAGS} -g -pg" #those are CXXFLAGS
-	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DDEBUG -DGIVARO_DEBUG" #those are CPPFLAGS
-else
-	DEFAULT_CFLAGS="-O2 ${DEFAULT_CFLAGS} -DNDEBUG -U_LB_DEBUG"
-fi
-
-
-
-if test "x$WARN" = "xyes" ; then
-	# if  test "x${CXX}" = "xicpc" -o "x${CXX}" = "xicc"  ; then
-	if test "x${CCNAM}" = "xicc" ; then
-		WARN_CFLAGS="${WARN_CFLAGS} -Wcheck"
-		# DEBUG_CFLAGS="-fast"
-	else
-		if test "x${CCNAM}" = "xgcc"  ; then
-			# WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter -Wuninitialized -Wconversion -Wcast-qual"
-			WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter -Wuninitialized -Wconversion -Wcast-qual -ansi -pedantic -Wno-long-long  -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings"
-		else
+	DEFAULT_CFLAGS="-O0 ${DEFAULT_CFLAGS} " #those are CXXFLAGS
+	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DDEBUG -DGIVARO_DEBUG"
+else
+	DEFAULT_CFLAGS="-O2 ${DEFAULT_CFLAGS} "
+	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DNDEBUG -UGIVARO_DEBUG -UDEBUG"
+fi
+
+if test "x$PROF" = "xyes" ; then
+	DEFAULT_CFLAGS="${DEFAULT_CFLAGS} -pg"
+fi
+
+if test "x$WARN" = "xyes" -o "x$WARN" = "xfull" ; then
+	case x${CCNAM} in
+		xicc)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wcheck"
+			# DEBUG_CFLAGS="-fast"
+			;;
+		xeko)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wno-unused-parameter"
+			;;
+		xgcc|xclang)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
+			if test "x${WARN}" = "xfull" ; then
+				WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -ansi -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long"
+			fi
+		;;
+		*)
 			echo
 			echo "*******************************************************"
 			echo "unsupported compiler ($CCNAM). Please file a bug."
 			echo "*******************************************************"
 			echo
 			WARN_CFLAGS="${WARN_CFLAGS}"
-		fi
-	fi
+	esac
 fi
 
 
@@ -4030,7 +4222,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4096,7 +4288,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4443,7 +4635,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4483,7 +4675,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4536,7 +4728,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4577,7 +4769,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -4635,7 +4827,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4679,7 +4871,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4875,8 +5067,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4983,7 +5174,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -5062,7 +5253,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -5318,7 +5509,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5362,7 +5553,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5781,7 +5972,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5821,7 +6012,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5993,7 +6184,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
   else
@@ -6127,7 +6318,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6167,7 +6358,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6270,7 +6461,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6314,7 +6505,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6439,7 +6630,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6479,7 +6670,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6538,7 +6729,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6578,7 +6769,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7214,7 +7405,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7254,7 +7445,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7334,7 +7525,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7374,7 +7565,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7426,7 +7617,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7466,7 +7657,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7518,7 +7709,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7558,7 +7749,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7610,7 +7801,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7650,7 +7841,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7702,7 +7893,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7742,7 +7933,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9095,9 +9286,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu | gnu*)
-    link_all_deplibs=no
-    ;;
   esac
 
   ld_shlibs=yes
@@ -9320,7 +9508,7 @@ _LT_EOF
       fi
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -9497,7 +9685,6 @@ _LT_EOF
 	if test "$aix_use_runtimelinking" = yes; then
 	  shared_flag="$shared_flag "'${wl}-G'
 	fi
-	link_all_deplibs=no
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -9954,7 +10141,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       link_all_deplibs=yes
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -10767,7 +10954,14 @@ freebsd* | dragonfly*)
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -10778,6 +10972,12 @@ freebsd* | dragonfly*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -10807,7 +11007,6 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
@@ -10991,18 +11190,6 @@ fi
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -13837,7 +14024,7 @@ lt_prog_compiler_static_CXX=
 	    ;;
 	esac
 	;;
-      netbsd* | netbsdelf*-gnu)
+      netbsd*)
 	;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -14206,9 +14393,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
       ;;
     esac
     ;;
-  linux* | k*bsd*-gnu | gnu*)
-    link_all_deplibs_CXX=no
-    ;;
   *)
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     ;;
@@ -14616,7 +14800,14 @@ freebsd* | dragonfly*)
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -14627,6 +14818,12 @@ freebsd* | dragonfly*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -14656,7 +14853,6 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
@@ -14840,18 +15036,6 @@ fi
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -15178,13 +15362,12 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-
 # newer libtool...
 
 
 
-#check lib
-# AC_CHECK_LIB([givaro], [main])
+
+echo "-----------------------------------------------"
 
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
@@ -15401,60 +15584,60 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include <stdbool.h>
-#ifndef bool
- "error: bool is not defined"
-#endif
-#ifndef false
- "error: false is not defined"
-#endif
-#if false
- "error: false is not 0"
-#endif
-#ifndef true
- "error: true is not defined"
-#endif
-#if true != 1
- "error: true is not 1"
-#endif
-#ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
-#endif
-
-	struct s { _Bool s: 1; _Bool t; } s;
-
-	char a[true == 1 ? 1 : -1];
-	char b[false == 0 ? 1 : -1];
-	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-	char d[(bool) 0.5 == true ? 1 : -1];
-	/* See body of main program for 'e'.  */
-	char f[(_Bool) 0.0 == false ? 1 : -1];
-	char g[true];
-	char h[sizeof (_Bool)];
-	char i[sizeof s.t];
-	enum { j = false, k = true, l = false * true, m = true * 256 };
-	/* The following fails for
-	   HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
-	_Bool n[m];
-	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-	/* Catch a bug in an HP-UX C compiler.  See
-	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-	 */
-	_Bool q = true;
-	_Bool *pq = &q;
+             #include <stdbool.h>
+             #ifndef bool
+              "error: bool is not defined"
+             #endif
+             #ifndef false
+              "error: false is not defined"
+             #endif
+             #if false
+              "error: false is not 0"
+             #endif
+             #ifndef true
+              "error: true is not defined"
+             #endif
+             #if true != 1
+              "error: true is not 1"
+             #endif
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
+             #endif
+
+             struct s { _Bool s: 1; _Bool t; } s;
+
+             char a[true == 1 ? 1 : -1];
+             char b[false == 0 ? 1 : -1];
+             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+             char d[(bool) 0.5 == true ? 1 : -1];
+             /* See body of main program for 'e'.  */
+             char f[(_Bool) 0.0 == false ? 1 : -1];
+             char g[true];
+             char h[sizeof (_Bool)];
+             char i[sizeof s.t];
+             enum { j = false, k = true, l = false * true, m = true * 256 };
+             /* The following fails for
+                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+             _Bool n[m];
+             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+             /* Catch a bug in an HP-UX C compiler.  See
+                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+              */
+             _Bool q = true;
+             _Bool *pq = &q;
 
 int
 main ()
 {
 
-	bool e = &s;
-	*pq |= q;
-	*pq |= ! q;
-	/* Refer to every declared value, to avoid compiler optimizations.  */
-	return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-		+ !m + !n + !o + !p + !q + !pq);
+             bool e = &s;
+             *pq |= q;
+             *pq |= ! q;
+             /* Refer to every declared value, to avoid compiler optimizations.  */
+             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                     + !m + !n + !o + !p + !q + !pq);
 
   ;
   return 0;
@@ -15469,7 +15652,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
-ac_fn_cxx_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+   ac_fn_cxx_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
 if test "x$ac_cv_type__Bool" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
@@ -15479,6 +15662,7 @@ _ACEOF
 
 fi
 
+
 if test $ac_cv_header_stdbool_h = yes; then
 
 $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
@@ -15496,11 +15680,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -15517,8 +15701,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -15534,10 +15719,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -16099,50 +16284,50 @@ if test ! -L src/library/vector/givaro ; then ln -s . src/library/vector/givaro
 
 # Create some useful data types of fixed, known lengths
 
-case 1 in
-  $ac_cv_sizeof_char)
-     GIVARO_INT8="char";
-     ;;
-esac
-
-case 2 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT16="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT16="int";
-     ;;
-esac
-
-case 4 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT32="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT32="int";
-     ;;
-  $ac_cv_sizeof_long)
-     GIVARO_INT32="long";
-     ;;
-esac
-
-case 8 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT64="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT64="int";
-     ;;
-  $ac_cv_sizeof_long)
-     GIVARO_INT64="long";
-     ;;
-  $ac_cv_sizeof_long_long)
-     GIVARO_INT64="long long";
-     ;;
-  $ac_cv_sizeof___int64)
-     GIVARO_INT64="__int64";
-     ;;
-esac
+# case 1 in
+  # $ac_cv_sizeof_char)
+     # GIVARO_INT8="char";
+     # ;;
+# esac
+
+# case 2 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT16="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT16="int";
+     # ;;
+# esac
+
+# case 4 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT32="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT32="int";
+     # ;;
+  # $ac_cv_sizeof_long)
+     # GIVARO_INT32="long";
+     # ;;
+# esac
+
+# case 8 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT64="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT64="int";
+     # ;;
+  # $ac_cv_sizeof_long)
+     # GIVARO_INT64="long";
+     # ;;
+  # $ac_cv_sizeof_long_long)
+     # GIVARO_INT64="long long";
+     # ;;
+  # $ac_cv_sizeof___int64)
+     # GIVARO_INT64="__int64";
+     # ;;
+# esac
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16172,6 +16357,7 @@ _ACEOF
 #    ;;
 #esac
 
+echo "-----------------------------------------------"
 # Feature checks
 
 ac_ext=cpp
@@ -16181,6 +16367,9 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
+echo "-----------------------------------------------"
+
+
 
 
 # Check whether --with-gmp was given.
@@ -16200,16 +16389,18 @@ min_gmp_version=3.1.1
 BACKUP_CXXFLAGS=${CXXFLAGS}
 BACKUP_LIBS=${LIBS}
 
-
+GMP_PATH=
 for GMP_HOME in ${GMP_HOME_PATH}
   do
 	if test "x$GMP_HOME" != "x/usr" -a "x$GMP_HOME" != "x/usr/local"; then
 		if test -r "$GMP_HOME/include/gmp.h" ; then
 			GMP_CFLAGS="-I${GMP_HOME}/include"
+			GMP_PATH="-L${GMP_HOME}/lib"
 			GMP_LIBS="-L${GMP_HOME}/lib -lgmp"
 		else
 		   if test -r "$GMP_HOME/gmp.h" ; then
 			GMP_CFLAGS="-I${GMP_HOME}"
+			GMP_PATH="-L${GMP_HOME}"
 			GMP_LIBS="-L${GMP_HOME} -lgmp"
 		   else
 			echo "($GMP_HOME) seems an invalid GMP prefix"
@@ -16229,7 +16420,14 @@ $as_echo_n "checking for GMP >= $min_gmp_version... " >&6; }
 
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <gmp.h>
+
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+#include <ansi/_cstddef.h>
+#endif
+#include "stddef.h"
+		#include <gmp.h>
+
 int
 main ()
 {
@@ -16256,7 +16454,13 @@ $as_echo "#define HAVE_GMP 1" >>confdefs.h
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <gmp.h>
+
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+		#include <ansi/_cstddef.h>
+		#include "stddef.h"
+#endif
+		#include <gmp.h>
 		 int main () {  if (__GNU_MP_VERSION < 3) return -1; else return 0; }
 
 _ACEOF
@@ -16280,6 +16484,12 @@ $as_echo "no" >&6; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+		#include <ansi/_cstddef.h>
+		#include "stddef.h"
+#endif
 #include <gmp.h>
 	    		int main () { if (__GNU_MP_VERSION < 4) return -1; else return 0; }
 
@@ -16308,6 +16518,8 @@ if ac_fn_cxx_try_run "$LINENO"; then :
 					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 					GMP_VERSION=""
+					GMP_LIBS="${GMP_PATH} -lgmpxx -lgmp"
+
 
 
 else
@@ -16355,8 +16567,8 @@ $as_echo "problem" >&6; }
 echo '*******************************************************************************'
 echo ' ERROR: GMP not found!'
 echo
-echo ' GMP version 3.1.1 or greater is required for this library to compile. Please'
-echo ' make sure GMP is installed and specify its location with the option'
+echo ' GMP library compiled with --enable-cxx is required for this library to compile.'
+echo ' Please make sure GMP is installed and specify its location with the option'
 echo ' --with-gmp=<prefix> when running configure.'
 echo '*******************************************************************************'
 exit 1
@@ -16379,8 +16591,8 @@ $as_echo "not found" >&6; }
 echo '*******************************************************************************'
 echo ' ERROR: GMP not found!'
 echo
-echo ' GMP version 3.1.1 or greater is required for this library to compile. Please'
-echo ' make sure GMP is installed and specify its location with the option'
+echo ' GMP library compiled with --enable-cxx is required for this library to compile.'
+echo ' Please make sure GMP is installed and specify its location with the option'
 echo ' --with-gmp=<prefix> when running configure.'
 echo '*******************************************************************************'
 exit 1
@@ -16431,9 +16643,9 @@ else
 fi
 
 
-# Check whether --enable-docs was given.
-if test "${enable_docs+set}" = set; then :
-  enableval=$enable_docs;
+# Check whether --enable-doc was given.
+if test "${enable_doc+set}" = set; then :
+  enableval=$enable_doc;
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether doxygen works" >&5
@@ -16449,6 +16661,14 @@ $as_echo "no" >&6; }
 	echo "the source tarball from http://www.stack.nl/~dimitri/doxygen/"
 	exit -1
 }
+ if true; then
+  GIVARO_DOXYGEN_FOUND_TRUE=
+  GIVARO_DOXYGEN_FOUND_FALSE='#'
+else
+  GIVARO_DOXYGEN_FOUND_TRUE='#'
+  GIVARO_DOXYGEN_FOUND_FALSE=
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
  if true; then
@@ -16460,8 +16680,29 @@ else
 fi
 
 
+
+else
+
+if (doxygen --version) < /dev/null > /dev/null 2>&1; then :
+   if true; then
+  GIVARO_DOXYGEN_FOUND_TRUE=
+  GIVARO_DOXYGEN_FOUND_FALSE='#'
+else
+  GIVARO_DOXYGEN_FOUND_TRUE='#'
+  GIVARO_DOXYGEN_FOUND_FALSE=
+fi
+
+else
+   if false; then
+  GIVARO_DOXYGEN_FOUND_TRUE=
+  GIVARO_DOXYGEN_FOUND_FALSE='#'
 else
+  GIVARO_DOXYGEN_FOUND_TRUE='#'
+  GIVARO_DOXYGEN_FOUND_FALSE=
+fi
+
 
+fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
  if false; then
@@ -16476,11 +16717,31 @@ fi
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether dot works" >&5
+$as_echo_n "checking whether dot works... " >&6; }
+res=yes;
+(dot -V) < /dev/null > /dev/null 2>&1 || res=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $res" >&5
+$as_echo "$res" >&6; }
+if test $res = yes; then :
+
+sed 's/^HAVE_DOT.*/HAVE_DOT = YES/' docs/Doxyfile.mod > docs/Doxyfile
+sed 's/^HAVE_DOT.*/HAVE_DOT = YES/' docs/DoxyfileDev.mod > docs/DoxyfileDev
+
+else
+   cp docs/Doxyfile.mod docs/Doxyfile ;
+cp docs/DoxyfileDev.mod docs/DoxyfileDev
+
+fi
+
+
+
 
 CXXFLAGS="${GMP_CFLAGS} ${CXXFLAGS}"
 LIBS="${GMP_LIBS}"
 
 
+echo "-----------------------------------------------"
 ac_config_files="$ac_config_files Makefile givaro-config givaro-makefile src/Makefile src/kernel/Makefile src/kernel/system/Makefile src/kernel/memory/Makefile src/kernel/gmp++/Makefile src/kernel/integer/Makefile src/kernel/bstruct/Makefile src/kernel/rational/Makefile src/kernel/zpz/Makefile src/library/Makefile src/library/vector/Makefile src/library/tools/Makefile src/library/poly1/Makefile src/library/matrix/Makefile macros/Makefile examples/Makefile examples/FiniteField/Makefile examples/Integer/Makefile examples/Rational/Makefile examples/Polynomial/Makefile tests/Makefile docs/Makefile"
 
 cat >confcache <<\_ACEOF
@@ -16592,6 +16853,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -16608,15 +16877,31 @@ if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then
   as_fn_error $? "conditional \"DEBUG\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${WARNINGS_TRUE}" && test -z "${WARNINGS_FALSE}"; then
-  as_fn_error $? "conditional \"WARNINGS\" was never defined.
+if test -z "${PROFILE_TRUE}" && test -z "${PROFILE_FALSE}"; then
+  as_fn_error $? "conditional \"PROFILE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GIVARO_INLINE_ALL_TRUE}" && test -z "${GIVARO_INLINE_ALL_FALSE}"; then
+  as_fn_error $? "conditional \"GIVARO_INLINE_ALL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
+if test -z "${GIVARO_DOXYGEN_FOUND_TRUE}" && test -z "${GIVARO_DOXYGEN_FOUND_FALSE}"; then
+  as_fn_error $? "conditional \"GIVARO_DOXYGEN_FOUND\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GIVARO_BUILD_DOC_TRUE}" && test -z "${GIVARO_BUILD_DOC_FALSE}"; then
   as_fn_error $? "conditional \"GIVARO_BUILD_DOC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${GIVARO_DOXYGEN_FOUND_TRUE}" && test -z "${GIVARO_DOXYGEN_FOUND_FALSE}"; then
+  as_fn_error $? "conditional \"GIVARO_DOXYGEN_FOUND\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GIVARO_DOXYGEN_FOUND_TRUE}" && test -z "${GIVARO_DOXYGEN_FOUND_FALSE}"; then
+  as_fn_error $? "conditional \"GIVARO_DOXYGEN_FOUND\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GIVARO_BUILD_DOC_TRUE}" && test -z "${GIVARO_BUILD_DOC_FALSE}"; then
   as_fn_error $? "conditional \"GIVARO_BUILD_DOC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -16919,16 +17204,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -16988,28 +17273,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -17030,8 +17303,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Givaro $as_me 3.4.2, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by Givaro $as_me 3.7.0, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -17097,11 +17370,11 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Givaro config.status 3.4.2
-configured by $0, generated by GNU Autoconf 2.68,
+Givaro config.status 3.7.0
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -17192,7 +17465,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
diff --git a/configure.ac b/configure.ac
index d88831a..fdeefb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@
 
 AC_PREREQ(2.61)
 
-AC_INIT([Givaro],[3.4.2],[Jean-Guillaume.Dumas at imag.fr],[givaro],
+AC_INIT([Givaro],[3.7.0],[Jean-Guillaume.Dumas at imag.fr],[givaro],
 		[http://ljk.imag.fr/CASYS/LOGICIELS/givaro])
 AC_CONFIG_MACRO_DIR([macros])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -28,9 +28,14 @@ AC_SUBST([MKDIR_P])
 
 AC_LANG([C++])
 
+echo "-----------------------------------------------"
+
 AC_DEBUG
-# AC_FULL_DEBUG
+AC_PROFILE
 AC_WARNINGS
+AC_INLINE
+
+echo "-----------------------------------------------"
 
 # CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
 # CXXFLAGS=${CXXFLAGS:-$DEFAULT_CXXFLAGS}
@@ -39,6 +44,7 @@ AC_WARNINGS
 # Try and pass different flags according to compiler #
 ######################################################
 
+
 # disable default -g -O2 CXXFLAGS
 : ${CXXFLAGS=""}
 
@@ -51,38 +57,46 @@ AC_SUBST([DEFAULT_CFLAGS])
 AC_SUBST([DEBUG_CFLAGS])
 AC_SUBST([TESTS_CFLAGS])
 
-TESTS_CFLAGS="-O0 -g"
+TESTS_CFLAGS="-O0"
 DEBUG_CFLAGS="-g"
 DEFAULT_CFLAGS="-pipe"
 WARN_CFLAGS="-Wall"
 
 if test "x$DBG" = "xyes" ; then
-	DEFAULT_CFLAGS="-O0 ${DEFAULT_CFLAGS} -g -pg" #those are CXXFLAGS
-	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DDEBUG -DGIVARO_DEBUG" #those are CPPFLAGS
+	DEFAULT_CFLAGS="-O0 ${DEFAULT_CFLAGS} " #those are CXXFLAGS
+	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DDEBUG -DGIVARO_DEBUG"
 else
-	DEFAULT_CFLAGS="-O2 ${DEFAULT_CFLAGS} -DNDEBUG -U_LB_DEBUG"
+	DEFAULT_CFLAGS="-O2 ${DEFAULT_CFLAGS} "
+	DEBUG_CFLAGS="${DEBUG_CFLAGS} -DNDEBUG -UGIVARO_DEBUG -UDEBUG"
 fi
 
+if test "x$PROF" = "xyes" ; then
+	DEFAULT_CFLAGS="${DEFAULT_CFLAGS} -pg"
+fi
 
-
-if test "x$WARN" = "xyes" ; then
-	# if  test "x${CXX}" = "xicpc" -o "x${CXX}" = "xicc"  ; then
-	if test "x${CCNAM}" = "xicc" ; then
-		WARN_CFLAGS="${WARN_CFLAGS} -Wcheck"
-		# DEBUG_CFLAGS="-fast"
-	else
-		if test "x${CCNAM}" = "xgcc"  ; then
-			# WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter -Wuninitialized -Wconversion -Wcast-qual"
-			WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter -Wuninitialized -Wconversion -Wcast-qual -ansi -pedantic -Wno-long-long  -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings"
-		else
+if test "x$WARN" = "xyes" -o "x$WARN" = "xfull" ; then
+	case x${CCNAM} in
+		xicc)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wcheck"
+			# DEBUG_CFLAGS="-fast"
+			;;
+		xeko)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wno-unused-parameter"
+			;;
+		xgcc|xclang)
+			WARN_CFLAGS="${WARN_CFLAGS} -Wextra -Wno-unused-parameter"
+			if test "x${WARN}" = "xfull" ; then
+				WARN_CFLAGS="${WARN_CFLAGS} -Wuninitialized -Wconversion -Wcast-qual -ansi -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-long"
+			fi
+		;;
+		*)
 			echo
 			echo "*******************************************************"
 			echo "unsupported compiler ($CCNAM). Please file a bug."
 			echo "*******************************************************"
 			echo
 			WARN_CFLAGS="${WARN_CFLAGS}"
-		fi
-	fi
+	esac
 fi
 
 
@@ -92,14 +106,13 @@ TESTS_CFLAGS="${TESTS_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
 
 AC_HEADER_STDC
 AC_PROG_LIBTOOL
-AM_PROG_LIBTOOL
 
 # newer libtool...
 LT_PREREQ([2.2])
 LT_INIT
 
-#check lib
-# AC_CHECK_LIB([givaro], [main])
+
+echo "-----------------------------------------------"
 
 # Checks for header files.
 AC_HEADER_STDC
@@ -154,50 +167,50 @@ if test ! -L src/library/vector/givaro ; then ln -s . src/library/vector/givaro
 
 # Create some useful data types of fixed, known lengths
 
-case 1 in
-  $ac_cv_sizeof_char)
-     GIVARO_INT8="char";
-     ;;
-esac
-
-case 2 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT16="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT16="int";
-     ;;
-esac
-
-case 4 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT32="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT32="int";
-     ;;
-  $ac_cv_sizeof_long)
-     GIVARO_INT32="long";
-     ;;
-esac
-
-case 8 in
-  $ac_cv_sizeof_short)
-     GIVARO_INT64="short";
-     ;;
-  $ac_cv_sizeof_int)
-     GIVARO_INT64="int";
-     ;;
-  $ac_cv_sizeof_long)
-     GIVARO_INT64="long";
-     ;;
-  $ac_cv_sizeof_long_long)
-     GIVARO_INT64="long long";
-     ;;
-  $ac_cv_sizeof___int64)
-     GIVARO_INT64="__int64";
-     ;;
-esac
+# case 1 in
+  # $ac_cv_sizeof_char)
+     # GIVARO_INT8="char";
+     # ;;
+# esac
+
+# case 2 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT16="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT16="int";
+     # ;;
+# esac
+
+# case 4 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT32="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT32="int";
+     # ;;
+  # $ac_cv_sizeof_long)
+     # GIVARO_INT32="long";
+     # ;;
+# esac
+
+# case 8 in
+  # $ac_cv_sizeof_short)
+     # GIVARO_INT64="short";
+     # ;;
+  # $ac_cv_sizeof_int)
+     # GIVARO_INT64="int";
+     # ;;
+  # $ac_cv_sizeof_long)
+     # GIVARO_INT64="long";
+     # ;;
+  # $ac_cv_sizeof_long_long)
+     # GIVARO_INT64="long long";
+     # ;;
+  # $ac_cv_sizeof___int64)
+     # GIVARO_INT64="__int64";
+     # ;;
+# esac
 
 AC_DEFINE_UNQUOTED(INT8,  $GIVARO_INT8, Canonical 8-bit data type)
 AC_DEFINE_UNQUOTED(INT16, $GIVARO_INT16, Canonical 16-bit data type)
@@ -211,15 +224,19 @@ AC_DEFINE_UNQUOTED(INT64, $GIVARO_INT64, Canonical 64-bit data type)
 #    ;;
 #esac
 
+echo "-----------------------------------------------"
 # Feature checks
 
 AC_LANG_CPLUSPLUS
+
+echo "-----------------------------------------------"
+
 LB_CHECK_GMP(,,[
 echo '*******************************************************************************'
 echo ' ERROR: GMP not found!'
 echo
-echo ' GMP version 3.1.1 or greater is required for this library to compile. Please'
-echo ' make sure GMP is installed and specify its location with the option'
+echo ' GMP library compiled with --enable-cxx is required for this library to compile.'
+echo ' Please make sure GMP is installed and specify its location with the option'
 echo ' --with-gmp=<prefix> when running configure.'
 echo '*******************************************************************************'
 exit 1
@@ -231,6 +248,7 @@ CXXFLAGS="${GMP_CFLAGS} ${CXXFLAGS}"
 LIBS="${GMP_LIBS}"
 AC_SUBST(CXXFLAGS)
 
+echo "-----------------------------------------------"
 AC_CONFIG_FILES([
 Makefile
 givaro-config
diff --git a/docs/Doxyfile b/docs/Doxyfile.mod
similarity index 82%
rename from docs/Doxyfile
rename to docs/Doxyfile.mod
index 0a0fb07..c68ee59 100755
--- a/docs/Doxyfile
+++ b/docs/Doxyfile.mod
@@ -1,14 +1,14 @@
-# Doxyfile 1.7.1
+# Doxyfile 1.8.0
 
 # This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
+# doxygen (www.doxygen.org) for a project.
 #
-# All text after a hash (#) is considered a comment and will be ignored
+# All text after a hash (#) is considered a comment and will be ignored.
 # The format is:
 #       TAG = value [value, ...]
 # For lists items can also be appended using:
 #       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
+# Values that contain spaces should be placed between quotes (" ").
 
 #---------------------------------------------------------------------------
 # Project related configuration options
@@ -22,8 +22,9 @@
 
 DOXYFILE_ENCODING      = UTF-8
 
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
 
 PROJECT_NAME           = Givaro
 
@@ -33,6 +34,19 @@ PROJECT_NAME           = Givaro
 
 PROJECT_NUMBER         =
 
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
 # If a relative path is entered, it will be relative to the location
@@ -57,7 +71,7 @@ CREATE_SUBDIRS         = NO
 # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
 # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
 # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
 # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
 
 OUTPUT_LANGUAGE        = English
@@ -136,7 +150,7 @@ STRIP_FROM_PATH        =
 STRIP_FROM_INC_PATH    =
 
 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
+# (but less readable) file names. This can be useful if your file system
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
 SHORT_NAMES            = NO
@@ -191,6 +205,13 @@ TAB_SIZE               = 4
 
 ALIASES                = "bib=\xrefitem bib \"Bibliography\" \"Bibliography\""
 
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST              =
+
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
 # sources only. Doxygen will then generate output that is more tailored for C.
 # For instance, some of the names that are used will be different. The list
@@ -229,11 +250,20 @@ OPTIMIZE_OUTPUT_VHDL   = NO
 
 EXTENSION_MAPPING      =
 
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
 # to include (a tag file for) the STL sources as input, then you should
 # set this tag to YES in order to let doxygen match functions declarations and
 # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
+# func(std::string) {}). This also makes the inheritance and collaboration
 # diagrams that involve STL classes more complete and accurate.
 
 BUILTIN_STL_SUPPORT    = YES
@@ -251,7 +281,7 @@ SIP_SUPPORT            = NO
 
 # For Microsoft's IDL there are propget and propput attributes to indicate getter
 # and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
+# will make doxygen replace the get and set methods by a property in the
 # documentation. This will only work if the methods are indeed getting or
 # setting a simple type. If this is not the case, or you want to show the
 # methods anyway, you should set this option to NO.
@@ -273,6 +303,22 @@ DISTRIBUTE_GROUP_DOC   = YES
 
 SUBGROUPING            = YES
 
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields will be shown inline in the documentation
+# of the scope in which they are defined (i.e. file, namespace, or group
+# documentation), provided this scope is documented. If set to NO (the default),
+# structs, classes, and unions are shown on a separate page (for HTML and Man
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
 # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
 # is documented as struct, union, or enum with the name of the typedef. So
 # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
@@ -289,16 +335,27 @@ TYPEDEF_HIDES_STRUCT   = NO
 # For small to medium size projects (<1000 input files) the default value is
 # probably good enough. For larger projects a too small cache size can cause
 # doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
+# causing a significant performance penalty.
 # If the system has enough physical memory increasing the cache will improve the
 # performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
+# a logarithmic scale so increasing the size by one will roughly double the
 # memory usage. The cache size is given by this formula:
 # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
+# corresponding to a cache size of 2^16 = 65536 symbols.
 
 SYMBOL_CACHE_SIZE      = 0
 
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
@@ -315,6 +372,10 @@ EXTRACT_ALL            = NO
 
 EXTRACT_PRIVATE        = NO
 
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
 # If the EXTRACT_STATIC tag is set to YES all static members of a file
 # will be included in the documentation.
 
@@ -337,7 +398,7 @@ EXTRACT_LOCAL_METHODS  = NO
 # extracted and appear in the documentation as a namespace called
 # 'anonymous_namespace{file}', where file will be replaced with the base
 # name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
+# anonymous namespaces are hidden.
 
 EXTRACT_ANON_NSPACES   = NO
 
@@ -448,6 +509,15 @@ SORT_GROUP_NAMES       = NO
 
 SORT_BY_SCOPE_NAME     = NO
 
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
 # The GENERATE_TODOLIST tag can be used to enable (YES) or
 # disable (NO) the todo list. This list is created by putting \todo
 # commands in the documentation.
@@ -478,10 +548,10 @@ GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       =
 
 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
+# the initial value of a variable or macro consists of for it to appear in
 # the documentation. If the initializer consists of more lines than specified
 # here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
+# The appearance of the initializer of individual variables and macros in the
 # documentation can be controlled using \showinitializer or \hideinitializer
 # command in the documentation regardless of this setting.
 
@@ -531,6 +601,16 @@ FILE_VERSION_FILTER    =
 
 LAYOUT_FILE            =
 
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES         =
+
 #---------------------------------------------------------------------------
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
@@ -559,7 +639,7 @@ WARN_IF_UNDOCUMENTED   = YES
 
 WARN_IF_DOC_ERROR      = YES
 
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
 # functions that are documented, but have no documentation for their parameters
 # or return value. If set to NO (the default) doxygen will only warn about
 # wrong or incomplete parameter documentation, but not about the absence of
@@ -592,7 +672,7 @@ WARN_LOGFILE           = doxy.debug
 # with spaces.
 
 INPUT                  = .. \
-						 ../src \
+                         ../src \
                          ../docs \
                          ../examples \
                          ../tests
@@ -609,14 +689,15 @@ INPUT_ENCODING         = UTF-8
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
 # and *.h) to filter out the source-files in the directories. If left
 # blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
 
 FILE_PATTERNS          = *.cc \
                          *.cpp \
                          *.C \
                          *.h \
-						 *.inl \
+                         *.inl \
                          *.doxy
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
@@ -625,14 +706,18 @@ FILE_PATTERNS          = *.cc \
 
 RECURSIVE              = YES
 
-# The EXCLUDE tag can be used to specify files and/or directories that should
+# The EXCLUDE tag can be used to specify files and/or directories that should be
 # excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
 
-EXCLUDE                = CVS *_src.inl Attic
+EXCLUDE                = CVS \
+                         *_src.inl \
+                         Attic
 
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
 # from the input.
 
 EXCLUDE_SYMLINKS       = NO
@@ -643,7 +728,9 @@ EXCLUDE_SYMLINKS       = NO
 # against the file with absolute path, so to exclude all test directories
 # for example use the pattern */test/*
 
-EXCLUDE_PATTERNS       = */CVS/* *_src.inl */Attic/*
+EXCLUDE_PATTERNS       = */CVS/* \
+                         *_src.inl \
+                         */Attic/*
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
 # (namespaces, classes, functions, etc.) that should be excluded from the
@@ -664,7 +751,13 @@ EXAMPLE_PATH           = ..
 # and *.h) to filter out the source-files in the directories. If left
 # blank all files are included.
 
-EXAMPLE_PATTERNS       = *.C *.inl *INSTALL *COPYING *HACKING *AUTHORS *.html
+EXAMPLE_PATTERNS       = *.C \
+                         *.inl \
+                         *INSTALL \
+                         *COPYING \
+                         *HACKING \
+                         *AUTHORS \
+                         *.html
 
 # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
 # searched for input files to be used with the \include or \dontinclude
@@ -696,8 +789,8 @@ INPUT_FILTER           =
 # filter if there is a match.
 # The filters are a list of the form:
 # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
 
 FILTER_PATTERNS        =
 
@@ -707,6 +800,14 @@ FILTER_PATTERNS        =
 
 FILTER_SOURCE_FILES    = NO
 
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
 #---------------------------------------------------------------------------
 # configuration options related to source browsing
 #---------------------------------------------------------------------------
@@ -809,7 +910,14 @@ HTML_FILE_EXTENSION    = .html
 
 # The HTML_HEADER tag can be used to specify a personal HTML header for
 # each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
+# standard header. Note that when using a custom header you are responsible
+#  for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
 
 HTML_HEADER            =
 
@@ -824,12 +932,21 @@ HTML_FOOTER            =
 # fine-tune the look of the HTML output. If the tag is left blank doxygen
 # will generate a default style sheet. Note that doxygen will try to copy
 # the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
+# style sheet in the HTML output directory as well, or it will be erased!
 
 HTML_STYLESHEET        =
 
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
 # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the stylesheet and background images
+# Doxygen will adjust the colors in the style sheet and background images
 # according to this color. Hue is specified as an angle on a colorwheel,
 # see http://en.wikipedia.org/wiki/Hue for more information.
 # For instance the value 0 represents red, 60 is yellow, 120 is green,
@@ -1024,17 +1141,14 @@ GENERATE_ECLIPSEHELP   = NO
 
 ECLIPSE_DOC_ID         = org.doxygen.Project
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
 
 DISABLE_INDEX          = NO
 
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
 # structure should be generated to display hierarchical information.
 # If the tag value is set to YES, a side panel will be generated
@@ -1042,9 +1156,18 @@ ENUM_VALUES_PER_LINE   = 4
 # is generated for HTML Help). For this to work a browser that supports
 # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
 # Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
 
 GENERATE_TREEVIEW      = NO
 
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
 # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
 # and Class Hierarchy pages using a tree view instead of an ordered list.
 
@@ -1077,6 +1200,32 @@ FORMULA_FONTSIZE       = 10
 
 FORMULA_TRANSPARENT    = YES
 
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax.
+# However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     =
+
 # When the SEARCHENGINE tag is enabled doxygen will generate a search box
 # for the HTML output. The underlying search engine uses javascript
 # and DHTML and should work on any modern browser. Note that when using
@@ -1092,7 +1241,7 @@ SEARCHENGINE           = NO
 # using Javascript. Doxygen will generate the search PHP script and index
 # file to put on the web server. The advantage of the server
 # based approach is that it scales better to large projects and allows
-# full text search. The disadvances is that it is more difficult to setup
+# full text search. The disadvantages are that it is more difficult to setup
 # and does not have live searching capabilities.
 
 SERVER_BASED_SEARCH    = NO
@@ -1133,7 +1282,7 @@ MAKEINDEX_CMD_NAME     = makeindex
 COMPACT_LATEX          = NO
 
 # The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
+# by the printer. Possible values are: a4, letter, legal and
 # executive. If left blank a4wide will be used.
 
 PAPER_TYPE             = a4wide
@@ -1141,7 +1290,8 @@ PAPER_TYPE             = a4wide
 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
 # packages that should be included in the LaTeX output.
 
-EXTRA_PACKAGES         = stmaryrd amsmath
+EXTRA_PACKAGES         = stmaryrd \
+                         amsmath
 
 # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
 # the generated latex document. The header should contain everything until
@@ -1150,6 +1300,13 @@ EXTRA_PACKAGES         = stmaryrd amsmath
 
 LATEX_HEADER           =
 
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
 # is prepared for conversion to pdf (using ps2pdf). The pdf file will
 # contain links (just like the HTML output) instead of page references
@@ -1183,6 +1340,12 @@ LATEX_HIDE_INDICES     = NO
 
 LATEX_SOURCE_CODE      = NO
 
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
 #---------------------------------------------------------------------------
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
@@ -1214,7 +1377,7 @@ COMPACT_RTF            = NO
 
 RTF_HYPERLINKS         = NO
 
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# Load style sheet definitions from file. Syntax is similar to doxygen's
 # config file, i.e. a series of assignments. You only have to provide
 # replacements, missing definitions are set to their default value.
 
@@ -1350,7 +1513,7 @@ ENABLE_PREPROCESSING   = YES
 # compilation will be performed. Macro expansion can be done in a controlled
 # way by setting EXPAND_ONLY_PREDEF to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
 # then the macro expansion is limited to the macros specified with the
@@ -1359,7 +1522,7 @@ MACRO_EXPANSION        = NO
 EXPAND_ONLY_PREDEF     = NO
 
 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
 
 SEARCH_INCLUDES        = YES
 
@@ -1384,20 +1547,20 @@ INCLUDE_FILE_PATTERNS  =
 # undefined via #undef or recursively expanded use the := operator
 # instead of the = operator.
 
-PREDEFINED             =
+PREDEFINED             = DOXYGEN_SHOULD_SKIP_THIS
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
 # this tag can be used to specify a list of macro names that should be expanded.
 # The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
 
 EXPAND_AS_DEFINED      =
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
 
 SKIP_FUNCTION_MACROS   = YES
 
@@ -1405,22 +1568,18 @@ SKIP_FUNCTION_MACROS   = YES
 # Configuration::additions related to external references
 #---------------------------------------------------------------------------
 
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
 #
 # TAGFILES = file1 file2 ...
 # Adding location for the tag files is done as follows:
 #
 # TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
+# doxygen is run, you must also specify the path to the tagfile here.
 
 TAGFILES               =
 
@@ -1453,9 +1612,8 @@ PERL_PATH              = /usr/bin/perl
 # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
 # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
 # or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
 
 CLASS_DIAGRAMS         = YES
 
@@ -1489,14 +1647,12 @@ HAVE_DOT               = NO
 
 DOT_NUM_THREADS        = 0
 
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
 
 DOT_FONTNAME           = FreeSans.ttf
 
@@ -1505,17 +1661,16 @@ DOT_FONTNAME           = FreeSans.ttf
 
 DOT_FONTSIZE           = 10
 
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
 
 DOT_FONTPATH           =
 
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
 # will generate a graph for each documented class showing the direct and
 # indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
+# CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
@@ -1537,6 +1692,15 @@ GROUP_GRAPHS           = YES
 
 UML_LOOK               = NO
 
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# managable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
 # If set to YES, the inheritance and collaboration graphs will show the
 # relations between templates and their instances.
 
@@ -1573,7 +1737,7 @@ CALL_GRAPH             = NO
 CALLER_GRAPH           = NO
 
 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
+# will generate a graphical hierarchy of all classes instead of a textual one.
 
 GRAPHICAL_HIERARCHY    = YES
 
@@ -1585,11 +1749,22 @@ GRAPHICAL_HIERARCHY    = YES
 DIRECTORY_GRAPH        = YES
 
 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
 
 DOT_IMAGE_FORMAT       = png
 
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
 # The tag DOT_PATH can be used to specify the path where the dot tool can be
 # found. If left blank, it is assumed the dot tool can be found in the path.
 
@@ -1601,6 +1776,12 @@ DOT_PATH               =
 
 DOTFILE_DIRS           =
 
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
 # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
 # nodes that will be shown in the graph. If the number of nodes in a graph
 # becomes larger than this value, doxygen will truncate the graph, which is
diff --git a/docs/DoxyfileDev b/docs/DoxyfileDev.mod
similarity index 82%
rename from docs/DoxyfileDev
rename to docs/DoxyfileDev.mod
index 89688f7..021e02c 100755
--- a/docs/DoxyfileDev
+++ b/docs/DoxyfileDev.mod
@@ -1,14 +1,14 @@
-# Doxyfile 1.7.1
+# Doxyfile 1.8.0
 
 # This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
+# doxygen (www.doxygen.org) for a project.
 #
-# All text after a hash (#) is considered a comment and will be ignored
+# All text after a hash (#) is considered a comment and will be ignored.
 # The format is:
 #       TAG = value [value, ...]
 # For lists items can also be appended using:
 #       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
+# Values that contain spaces should be placed between quotes (" ").
 
 #---------------------------------------------------------------------------
 # Project related configuration options
@@ -22,8 +22,9 @@
 
 DOXYFILE_ENCODING      = UTF-8
 
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
 
 PROJECT_NAME           = Givaro
 
@@ -33,6 +34,19 @@ PROJECT_NAME           = Givaro
 
 PROJECT_NUMBER         =
 
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
 # If a relative path is entered, it will be relative to the location
@@ -57,7 +71,7 @@ CREATE_SUBDIRS         = NO
 # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
 # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
 # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
 # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
 
 OUTPUT_LANGUAGE        = English
@@ -136,7 +150,7 @@ STRIP_FROM_PATH        =
 STRIP_FROM_INC_PATH    =
 
 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
+# (but less readable) file names. This can be useful if your file system
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
 SHORT_NAMES            = NO
@@ -191,6 +205,13 @@ TAB_SIZE               = 4
 
 ALIASES                = "bib=\xrefitem bib \"Bibliography\" \"Bibliography\""
 
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST              =
+
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
 # sources only. Doxygen will then generate output that is more tailored for C.
 # For instance, some of the names that are used will be different. The list
@@ -229,11 +250,20 @@ OPTIMIZE_OUTPUT_VHDL   = NO
 
 EXTENSION_MAPPING      =
 
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
 # to include (a tag file for) the STL sources as input, then you should
 # set this tag to YES in order to let doxygen match functions declarations and
 # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
+# func(std::string) {}). This also makes the inheritance and collaboration
 # diagrams that involve STL classes more complete and accurate.
 
 BUILTIN_STL_SUPPORT    = YES
@@ -251,7 +281,7 @@ SIP_SUPPORT            = NO
 
 # For Microsoft's IDL there are propget and propput attributes to indicate getter
 # and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
+# will make doxygen replace the get and set methods by a property in the
 # documentation. This will only work if the methods are indeed getting or
 # setting a simple type. If this is not the case, or you want to show the
 # methods anyway, you should set this option to NO.
@@ -273,6 +303,22 @@ DISTRIBUTE_GROUP_DOC   = YES
 
 SUBGROUPING            = YES
 
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields will be shown inline in the documentation
+# of the scope in which they are defined (i.e. file, namespace, or group
+# documentation), provided this scope is documented. If set to NO (the default),
+# structs, classes, and unions are shown on a separate page (for HTML and Man
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
 # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
 # is documented as struct, union, or enum with the name of the typedef. So
 # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
@@ -289,16 +335,27 @@ TYPEDEF_HIDES_STRUCT   = NO
 # For small to medium size projects (<1000 input files) the default value is
 # probably good enough. For larger projects a too small cache size can cause
 # doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
+# causing a significant performance penalty.
 # If the system has enough physical memory increasing the cache will improve the
 # performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
+# a logarithmic scale so increasing the size by one will roughly double the
 # memory usage. The cache size is given by this formula:
 # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
+# corresponding to a cache size of 2^16 = 65536 symbols.
 
 SYMBOL_CACHE_SIZE      = 0
 
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
@@ -315,6 +372,10 @@ EXTRACT_ALL            = YES
 
 EXTRACT_PRIVATE        = NO
 
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
 # If the EXTRACT_STATIC tag is set to YES all static members of a file
 # will be included in the documentation.
 
@@ -337,7 +398,7 @@ EXTRACT_LOCAL_METHODS  = NO
 # extracted and appear in the documentation as a namespace called
 # 'anonymous_namespace{file}', where file will be replaced with the base
 # name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
+# anonymous namespaces are hidden.
 
 EXTRACT_ANON_NSPACES   = NO
 
@@ -448,6 +509,15 @@ SORT_GROUP_NAMES       = NO
 
 SORT_BY_SCOPE_NAME     = NO
 
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
 # The GENERATE_TODOLIST tag can be used to enable (YES) or
 # disable (NO) the todo list. This list is created by putting \todo
 # commands in the documentation.
@@ -478,10 +548,10 @@ GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       =
 
 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
+# the initial value of a variable or macro consists of for it to appear in
 # the documentation. If the initializer consists of more lines than specified
 # here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
+# The appearance of the initializer of individual variables and macros in the
 # documentation can be controlled using \showinitializer or \hideinitializer
 # command in the documentation regardless of this setting.
 
@@ -531,6 +601,16 @@ FILE_VERSION_FILTER    =
 
 LAYOUT_FILE            =
 
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES         =
+
 #---------------------------------------------------------------------------
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
@@ -559,7 +639,7 @@ WARN_IF_UNDOCUMENTED   = YES
 
 WARN_IF_DOC_ERROR      = YES
 
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
 # functions that are documented, but have no documentation for their parameters
 # or return value. If set to NO (the default) doxygen will only warn about
 # wrong or incomplete parameter documentation, but not about the absence of
@@ -592,7 +672,7 @@ WARN_LOGFILE           = doxydev.debug
 # with spaces.
 
 INPUT                  = .. \
-						 ../src \
+                         ../src \
                          ../docs \
                          ../examples \
                          ../tests
@@ -609,14 +689,15 @@ INPUT_ENCODING         = UTF-8
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
 # and *.h) to filter out the source-files in the directories. If left
 # blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
 
 FILE_PATTERNS          = *.cc \
                          *.cpp \
                          *.C \
                          *.h \
-						 *.inl \
+                         *.inl \
                          *.doxy
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
@@ -625,14 +706,18 @@ FILE_PATTERNS          = *.cc \
 
 RECURSIVE              = YES
 
-# The EXCLUDE tag can be used to specify files and/or directories that should
+# The EXCLUDE tag can be used to specify files and/or directories that should be
 # excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
 
-EXCLUDE                = CVS *_src.inl Attic
+EXCLUDE                = CVS \
+                         *_src.inl \
+                         Attic
 
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
 # from the input.
 
 EXCLUDE_SYMLINKS       = NO
@@ -643,7 +728,9 @@ EXCLUDE_SYMLINKS       = NO
 # against the file with absolute path, so to exclude all test directories
 # for example use the pattern */test/*
 
-EXCLUDE_PATTERNS       = */CVS/* *_src.inl */Attic/*
+EXCLUDE_PATTERNS       = */CVS/* \
+                         *_src.inl \
+                         */Attic/*
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
 # (namespaces, classes, functions, etc.) that should be excluded from the
@@ -664,7 +751,13 @@ EXAMPLE_PATH           = ..
 # and *.h) to filter out the source-files in the directories. If left
 # blank all files are included.
 
-EXAMPLE_PATTERNS       = *.C *.inl *INSTALL *COPYING *HACKING *AUTHORS *.html
+EXAMPLE_PATTERNS       = *.C \
+                         *.inl \
+                         *INSTALL \
+                         *COPYING \
+                         *HACKING \
+                         *AUTHORS \
+                         *.html
 
 # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
 # searched for input files to be used with the \include or \dontinclude
@@ -696,8 +789,8 @@ INPUT_FILTER           =
 # filter if there is a match.
 # The filters are a list of the form:
 # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
 
 FILTER_PATTERNS        =
 
@@ -707,6 +800,14 @@ FILTER_PATTERNS        =
 
 FILTER_SOURCE_FILES    = NO
 
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
 #---------------------------------------------------------------------------
 # configuration options related to source browsing
 #---------------------------------------------------------------------------
@@ -809,7 +910,14 @@ HTML_FILE_EXTENSION    = .html
 
 # The HTML_HEADER tag can be used to specify a personal HTML header for
 # each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
+# standard header. Note that when using a custom header you are responsible
+#  for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
 
 HTML_HEADER            =
 
@@ -824,12 +932,21 @@ HTML_FOOTER            =
 # fine-tune the look of the HTML output. If the tag is left blank doxygen
 # will generate a default style sheet. Note that doxygen will try to copy
 # the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
+# style sheet in the HTML output directory as well, or it will be erased!
 
 HTML_STYLESHEET        =
 
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
 # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the stylesheet and background images
+# Doxygen will adjust the colors in the style sheet and background images
 # according to this color. Hue is specified as an angle on a colorwheel,
 # see http://en.wikipedia.org/wiki/Hue for more information.
 # For instance the value 0 represents red, 60 is yellow, 120 is green,
@@ -1024,17 +1141,14 @@ GENERATE_ECLIPSEHELP   = NO
 
 ECLIPSE_DOC_ID         = org.doxygen.Project
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
 
 DISABLE_INDEX          = NO
 
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
 # structure should be generated to display hierarchical information.
 # If the tag value is set to YES, a side panel will be generated
@@ -1042,9 +1156,18 @@ ENUM_VALUES_PER_LINE   = 4
 # is generated for HTML Help). For this to work a browser that supports
 # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
 # Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
 
 GENERATE_TREEVIEW      = NO
 
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
 # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
 # and Class Hierarchy pages using a tree view instead of an ordered list.
 
@@ -1077,6 +1200,32 @@ FORMULA_FONTSIZE       = 10
 
 FORMULA_TRANSPARENT    = YES
 
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax.
+# However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     =
+
 # When the SEARCHENGINE tag is enabled doxygen will generate a search box
 # for the HTML output. The underlying search engine uses javascript
 # and DHTML and should work on any modern browser. Note that when using
@@ -1092,7 +1241,7 @@ SEARCHENGINE           = NO
 # using Javascript. Doxygen will generate the search PHP script and index
 # file to put on the web server. The advantage of the server
 # based approach is that it scales better to large projects and allows
-# full text search. The disadvances is that it is more difficult to setup
+# full text search. The disadvantages are that it is more difficult to setup
 # and does not have live searching capabilities.
 
 SERVER_BASED_SEARCH    = NO
@@ -1133,7 +1282,7 @@ MAKEINDEX_CMD_NAME     = makeindex
 COMPACT_LATEX          = NO
 
 # The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
+# by the printer. Possible values are: a4, letter, legal and
 # executive. If left blank a4wide will be used.
 
 PAPER_TYPE             = a4wide
@@ -1141,7 +1290,8 @@ PAPER_TYPE             = a4wide
 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
 # packages that should be included in the LaTeX output.
 
-EXTRA_PACKAGES         = stmaryrd amsmath
+EXTRA_PACKAGES         = stmaryrd \
+                         amsmath
 
 # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
 # the generated latex document. The header should contain everything until
@@ -1150,6 +1300,13 @@ EXTRA_PACKAGES         = stmaryrd amsmath
 
 LATEX_HEADER           =
 
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
 # is prepared for conversion to pdf (using ps2pdf). The pdf file will
 # contain links (just like the HTML output) instead of page references
@@ -1183,6 +1340,12 @@ LATEX_HIDE_INDICES     = NO
 
 LATEX_SOURCE_CODE      = NO
 
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
 #---------------------------------------------------------------------------
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
@@ -1214,7 +1377,7 @@ COMPACT_RTF            = NO
 
 RTF_HYPERLINKS         = NO
 
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# Load style sheet definitions from file. Syntax is similar to doxygen's
 # config file, i.e. a series of assignments. You only have to provide
 # replacements, missing definitions are set to their default value.
 
@@ -1350,7 +1513,7 @@ ENABLE_PREPROCESSING   = YES
 # compilation will be performed. Macro expansion can be done in a controlled
 # way by setting EXPAND_ONLY_PREDEF to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
 # then the macro expansion is limited to the macros specified with the
@@ -1359,7 +1522,7 @@ MACRO_EXPANSION        = NO
 EXPAND_ONLY_PREDEF     = NO
 
 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
 
 SEARCH_INCLUDES        = YES
 
@@ -1384,20 +1547,20 @@ INCLUDE_FILE_PATTERNS  =
 # undefined via #undef or recursively expanded use the := operator
 # instead of the = operator.
 
-PREDEFINED             =
+PREDEFINED             = DOXYGEN_SHOULD_SKIP_THIS
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
 # this tag can be used to specify a list of macro names that should be expanded.
 # The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
 
 EXPAND_AS_DEFINED      =
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
 
 SKIP_FUNCTION_MACROS   = YES
 
@@ -1405,22 +1568,18 @@ SKIP_FUNCTION_MACROS   = YES
 # Configuration::additions related to external references
 #---------------------------------------------------------------------------
 
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
 #
 # TAGFILES = file1 file2 ...
 # Adding location for the tag files is done as follows:
 #
 # TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
+# doxygen is run, you must also specify the path to the tagfile here.
 
 TAGFILES               =
 
@@ -1453,9 +1612,8 @@ PERL_PATH              = /usr/bin/perl
 # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
 # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
 # or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
 
 CLASS_DIAGRAMS         = YES
 
@@ -1489,14 +1647,12 @@ HAVE_DOT               = NO
 
 DOT_NUM_THREADS        = 0
 
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
 
 DOT_FONTNAME           = FreeSans.ttf
 
@@ -1505,17 +1661,16 @@ DOT_FONTNAME           = FreeSans.ttf
 
 DOT_FONTSIZE           = 10
 
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
 
 DOT_FONTPATH           =
 
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
 # will generate a graph for each documented class showing the direct and
 # indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
+# CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
@@ -1537,6 +1692,15 @@ GROUP_GRAPHS           = YES
 
 UML_LOOK               = NO
 
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# managable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
 # If set to YES, the inheritance and collaboration graphs will show the
 # relations between templates and their instances.
 
@@ -1573,7 +1737,7 @@ CALL_GRAPH             = NO
 CALLER_GRAPH           = NO
 
 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
+# will generate a graphical hierarchy of all classes instead of a textual one.
 
 GRAPHICAL_HIERARCHY    = YES
 
@@ -1585,11 +1749,22 @@ GRAPHICAL_HIERARCHY    = YES
 DIRECTORY_GRAPH        = YES
 
 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
 
 DOT_IMAGE_FORMAT       = png
 
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
 # The tag DOT_PATH can be used to specify the path where the dot tool can be
 # found. If left blank, it is assumed the dot tool can be found in the path.
 
@@ -1601,6 +1776,12 @@ DOT_PATH               =
 
 DOTFILE_DIRS           =
 
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
 # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
 # nodes that will be shown in the graph. If the number of nodes in a graph
 # becomes larger than this value, doxygen will truncate the graph, which is
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ef1c5ba..f82183e 100755
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -9,17 +9,20 @@ if GIVARO_BUILD_DOC
 USE_TARGETS = docs
 INSTALL_TARGETS = install-doc
 endif
+
 docdir=$(GIVARO_DOC_PATH)
 
 #man1_MANS = givaro-config.1
 
 all all-local: $(USE_TARGETS)
 
-install install-data-local: $(INSTALL_TARGETS)
+install install-data-local: $(USE_TARGETS) $(INSTALL_TARGETS)
 
+if GIVARO_DOXYGEN_FOUND
 docs:
 	sed -i 's/^\\version.*/\\version\ $(VERSION)/' mainpage.doxy
 	if test -d givaro-html ; then echo exists; else mkdir givaro-html ; fi
+	if test -d givaro-dev-html ; then echo exists; else mkdir givaro-dev-html ; fi
 	cp ../INSTALL givaro-html/
 	cp ../COPYING givaro-html/
 	cp ../AUTHORS givaro-html/
@@ -45,15 +48,26 @@ docs_dev:
 
 
 install-doc:
-	mkdir $(docdir)
-	cp -r givaro-html $(docdir)/givaro-html
-	cp -r givaro-dev-html $(docdir)/givaro-dev-html
-	cp givaro.html $(docdir)/givaro.html
+	mkdir -p               $(DESTDIR)/$(docdir)
+	cp -rp givaro-html     $(DESTDIR)/$(docdir)/givaro-html
+	cp -rp givaro-dev-html $(DESTDIR)/$(docdir)/givaro-dev-html
+	cp -p givaro.html      $(DESTDIR)/$(docdir)/givaro.html
+
+else
+
+docs:
+	@echo
+	@echo "*** ERROR ***"
+	@echo "you need doxygen to build documentation"
+	@echo
+
+endif
 
 EXTRA_DIST= \
-			Doxyfile            \
-			DoxyfileDev         \
-			mainpage.doxy
+			Doxyfile.mod            \
+			DoxyfileDev.mod         \
+			mainpage.doxy \
+			givaro.html
 # \
 #			doc.doxy            \
 #			tutorial.doxy       \
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 62b00ad..0fd0fd0 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,9 +21,27 @@
 # and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -56,10 +74,16 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -90,6 +114,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -125,6 +150,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -188,9 +214,10 @@ top_srcdir = @top_srcdir@
 @GIVARO_BUILD_DOC_TRUE at USE_TARGETS = docs
 @GIVARO_BUILD_DOC_TRUE at INSTALL_TARGETS = install-doc
 EXTRA_DIST = \
-			Doxyfile            \
-			DoxyfileDev         \
-			mainpage.doxy
+			Doxyfile.mod            \
+			DoxyfileDev.mod         \
+			mainpage.doxy \
+			givaro.html
 
 all: all-am
 
@@ -204,9 +231,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps docs/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps docs/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps docs/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps docs/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -224,6 +251,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -253,13 +281,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -277,16 +309,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -376,15 +414,16 @@ uninstall-am:
 
 all all-local: $(USE_TARGETS)
 
-install install-data-local: $(INSTALL_TARGETS)
+install install-data-local: $(USE_TARGETS) $(INSTALL_TARGETS)
 
-docs:
-	sed -i 's/^\\version.*/\\version\ $(VERSION)/' mainpage.doxy
-	if test -d givaro-html ; then echo exists; else mkdir givaro-html ; fi
-	cp ../INSTALL givaro-html/
-	cp ../COPYING givaro-html/
-	cp ../AUTHORS givaro-html/
-	doxygen Doxyfile
+ at GIVARO_DOXYGEN_FOUND_TRUE@docs:
+ at GIVARO_DOXYGEN_FOUND_TRUE@	sed -i 's/^\\version.*/\\version\ $(VERSION)/' mainpage.doxy
+ at GIVARO_DOXYGEN_FOUND_TRUE@	if test -d givaro-html ; then echo exists; else mkdir givaro-html ; fi
+ at GIVARO_DOXYGEN_FOUND_TRUE@	if test -d givaro-dev-html ; then echo exists; else mkdir givaro-dev-html ; fi
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../INSTALL givaro-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../COPYING givaro-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../AUTHORS givaro-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	doxygen Doxyfile
 
 #  if test -d givaro-dev-html ; then echo exists; else mkdir givaro-dev-html ; fi
 #  cp index-dev.html givaro-dev-html/index.html
@@ -392,22 +431,28 @@ docs:
 #  cp install-dist.html givaro-html/
 #  cp install-dev.html givaro-html/
 
-docs_dev:
-	make docs
-	cp ../INSTALL givaro-dev-html/
-	cp ../COPYING givaro-dev-html/
-	cp ../AUTHORS givaro-dev-html/
-	doxygen DoxyfileDev
+ at GIVARO_DOXYGEN_FOUND_TRUE@docs_dev:
+ at GIVARO_DOXYGEN_FOUND_TRUE@	make docs
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../INSTALL givaro-dev-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../COPYING givaro-dev-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp ../AUTHORS givaro-dev-html/
+ at GIVARO_DOXYGEN_FOUND_TRUE@	doxygen DoxyfileDev
 
 #  cp tutorial.html givaro-dev-html/
 #  cp install-dist.html givaro-dev-html/
 #  cp install-dev.html givaro-dev-html/
 
-install-doc:
-	mkdir $(docdir)
-	cp -r givaro-html $(docdir)/givaro-html
-	cp -r givaro-dev-html $(docdir)/givaro-dev-html
-	cp givaro.html $(docdir)/givaro.html
+ at GIVARO_DOXYGEN_FOUND_TRUE@install-doc:
+ at GIVARO_DOXYGEN_FOUND_TRUE@	mkdir -p               $(DESTDIR)/$(docdir)
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp -rp givaro-html     $(DESTDIR)/$(docdir)/givaro-html
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp -rp givaro-dev-html $(DESTDIR)/$(docdir)/givaro-dev-html
+ at GIVARO_DOXYGEN_FOUND_TRUE@	cp -p givaro.html      $(DESTDIR)/$(docdir)/givaro.html
+
+ at GIVARO_DOXYGEN_FOUND_FALSE@docs:
+ at GIVARO_DOXYGEN_FOUND_FALSE@	@echo
+ at GIVARO_DOXYGEN_FOUND_FALSE@	@echo "*** ERROR ***"
+ at GIVARO_DOXYGEN_FOUND_FALSE@	@echo "you need doxygen to build documentation"
+ at GIVARO_DOXYGEN_FOUND_FALSE@	@echo
 # \
 #			doc.doxy            \
 #			tutorial.doxy       \
@@ -421,6 +466,7 @@ install-doc:
 clean-local :
 	rm -rf givaro-html
 	rm -rf givaro-dev-html
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/docs/givaro.html b/docs/givaro.html
new file mode 100644
index 0000000..b0e6287
--- /dev/null
+++ b/docs/givaro.html
@@ -0,0 +1,18 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--  Copyright (C) 2005 David Saunders, part of Givaro, GNU LGPL, see COPYING
+-->
+<html><head>
+<title> Starter to Givaro documentation</title>
+<!-- the following causes my Givaro to load after 5 seconds
+-->
+<meta http-equiv="Refresh"
+  content="5; URL=givaro-html/index.html">
+  </head><body>
+  <!-- the following shows during the initial 5 seconds-->
+  Givaro documentation main page: <a href="givaro-html/index.html"> givaro-html/index.html</a>
+  (going there in 5 seconds).
+
+  If it is a dead link, you have to build the documentation first
+  with <tt>make docs</tt>.
+
+</body>  </html>
diff --git a/docs/mainpage.doxy b/docs/mainpage.doxy
index 7f9a926..bc8bf44 100755
--- a/docs/mainpage.doxy
+++ b/docs/mainpage.doxy
@@ -1,35 +1,56 @@
 /** @mainpage Givaro Documentation.
-  Givaro is a C++ library for arithmetic and algebraic computations.
-
-\section intro Introduction
-
-Givaro can do fast arithmetic computations with
-- Integers. The Integer class uses GMP integers.
-- Rationals.
-- Rings of the form \f$\mathbf{Z}/m\mathbf{Z}\f$.
-- Prime fields and extensions.
-- Polynomials.
-.
+ *  Givaro is a C++ library for arithmetic and algebraic computations.
+ *
+ * \section intro Introduction
+ *
+ * Givaro can do fast arithmetic computations with
+ * - Integers. The Integer class uses GMP integers.
+ * - Rationals.
+ * - Rings of the form \f$\mathbf{Z}/m\mathbf{Z}\f$.
+ * - Prime fields and extensions.
+ * - Polynomials.
+ * .
+ *
+ * Non-standard arithmetic tools include trucated arithmetic.
+ *
+ * \section goals Goals
+ *
+ * \section desig Design
+ *
+ * \section using Using Givaro
+ * - \subpage copy.
+ * - \subpage tuto. This is a brief introduction to %LinBox capabilities.
+ * - \subpage inst. Explains how to install from sources or from the latest cvs version.
+ * - \subpage arch. Describes how Givaro is organized
+ * - <a href="../givaro-html/index.html"     style="color: blue  ; font-weight: bold">
+ * Documentation for Users</a>. If everything around is blue, then you are reading
+ * the lighter, user-oriented, documentation.
+ * - <a href="../givaro-dev-html/index.html" style="color: green ; font-weight: bold">
+ * Documentation for Developers</a>. If everything around is green, then you can
+ * get to everything (not necessarily yet) documented.
+ * .
+ * \section contrib Contributing to Givaro, getting assistance.
+ \version 3.6.0
+ */
 
-Non-standard arithmetic tools include trucated arithmetic.
+/**
+ * \page tuto Tutorial.
+ * Empty.
+ */
 
-\section goals Goals
+/**
+ * \page copy Licence.
+ * Empty.
+ */
 
-\section desig Design
+/**
+ * \page inst Installation.
+ * Empty.
+ */
 
-\section using Using Givaro
-- \subpage copy.
-- \subpage tuto. This is a brief introduction to %LinBox capabilities.
-- \subpage inst. Explains how to install from sources or from the latest cvs version.
-- \subpage arch. Describes how Givaro is organized
-- <a href="../givaro-html/index.html"     style="color: blue  ; font-weight: bold">
-Documentation for Users</a>. If everything around is blue, then you are reading
-the lighter, user-oriented, documentation.
-- <a href="../givaro-dev-html/index.html" style="color: green ; font-weight: bold">
-Documentation for Developers</a>. If everything around is green, then you can
-get to everything (not necessarily yet) documented.
-.
-\section contrib Contributing to Givaro, getting assistance.
-\version 3.3.5
+/**
+ * \page arch Architecture.
+ * Empty.
  */
+
 // vim:syn=doxygen
diff --git a/examples/FiniteField/GFirreducible.C b/examples/FiniteField/GFirreducible.C
index 1acbbe3..5c8b2d0 100644
--- a/examples/FiniteField/GFirreducible.C
+++ b/examples/FiniteField/GFirreducible.C
@@ -27,8 +27,9 @@ int main(int argc, char** argv)
 
     long p = (argc>1?atoi(argv[1]):5);
     long e = (argc>2?atoi(argv[2]):3);
-    GFqDom<long> GFq(p, e);
-    GFqDom<long> PrimeField(p,1);
+	typedef GFqDom<long>::Residu_t TT ;
+    GFqDom<long> GFq((TT)p, (TT)e);
+    GFqDom<long> PrimeField((TT)p,1);
     std::cout << "Working in GF(" << p << '^' << e << ')' << std::endl;
     std::cout << "Elements are polynomials in X modulo " << p << std::endl;
 
@@ -40,7 +41,7 @@ int main(int argc, char** argv)
     GFqDom<long>::Element temo, t, tmp;
     Poly1Dom< GFqDom<long>, Dense >::Element G, H, J, mQ, irred, modP;
 
-    Pdom.init(G, Degree(GFq.exponent()-1)); // X^(e-1)
+    Pdom.init(G, Degree((long)GFq.exponent()-1)); // X^(e-1)
     GFq.init(temo,G); // internal representation
 
     Pdom.init(H, Degree(1) ); // X
@@ -52,7 +53,7 @@ int main(int argc, char** argv)
     GFq.negin(tmp); 	   // internal representation of -X^e, i.e. of the irreducible polynomial without the largest monomial, X^e
 
     long lowerpart;
-        // p-adic value of the lower part of the irreducible polynomial  
+        // p-adic value of the lower part of the irreducible polynomial
     GFq.convert(lowerpart, tmp);
     std::cout << ' ' << p << "-adic value of the lower part of the irreducible : " << lowerpart << std::endl;
 
diff --git a/examples/FiniteField/GaloisFields.C b/examples/FiniteField/GaloisFields.C
index 0711449..29236d9 100644
--- a/examples/FiniteField/GaloisFields.C
+++ b/examples/FiniteField/GaloisFields.C
@@ -7,26 +7,33 @@
 #include <iostream>
 #include <givaro/givgfq.h>
 #include <givaro/givextension.h>
+#include <givaro/givzpz16std.h>
 #include <givaro/givzpz64std.h>
 
 using namespace Givaro;
 
 int main (int argc, char * * argv) {
-    unsigned long q = (argc>1?atoi(argv[1]):13);
-    unsigned long expo = (argc>2?atoi(argv[2]):8);
-    
+    unsigned long q = (argc>1?(unsigned long)atoi(argv[1]):13);
+    unsigned long expo = (argc>2?(unsigned long)atoi(argv[2]):8);
+
     {
-            // This is the field with 11^2=121 éléments
+            // This is the field with 11^2=121 elements
             // Using a generator representation and tables
         GFqDom<long> F1(11,2);
         F1.write(std::cout << "This is the field with 121 elements: ") << std::endl;
+        std::cout << " using: " << F1.irreducible() << " as irreducible polynomial" << std::endl;
+        GFqDom<long>::Element primroot; F1.generator(primroot);
+        F1.write(std::cout << " represented as indexes with respect to the generator: ", primroot) << std::endl;
+        std::cout << " represented as indexes with respect to the generator: " << F1.generator() << std::endl;
+
     }
-    
+
     {
-            // This is the field with q^expo éléments using the best 
+            // This is the field with q^expo elements using the best
             // possible base field
 
-        std::cout << "Exponent max for zech logs " << q << '^' << expo << " : " << FF_EXPONENT_MAX(q,expo) << std::endl;
+        std::cerr << "Exponent max for zech logs with characteristic " << q << " : " << FF_EXPONENT_MAX(q,expo) << std::endl;
+        std::cerr << "Sub-Exponent max for zech logs " << q << "^" << expo << " : " << FF_SUBEXPONENT_MAX(q,expo) << std::endl;
         std::cout << "NEED polynomial representation : " << NEED_POLYNOMIAL_REPRESENTATION(q,expo) << std::endl;
 
         if ( NEED_POLYNOMIAL_REPRESENTATION(q,expo) ) {
@@ -39,24 +46,149 @@ int main (int argc, char * * argv) {
             Fqe.write(std::cout << "This is the field with " << q << '^' << expo << " elements: ") << std::endl;
         }
     }
-    
 
-        // This is the field with 11^2=121 éléments
+
+        // This is the field with 11^2=121 elements
         // Using a polynomial representation
     {
-        GFqDom<long> F11(11);
-        Extension< GFqDom<long> > F121(F11, 2);
-        F121.write(std::cout << "This is the field with 121 elements: ") << std::endl;
+	    GFqDom<long> F11(11);
+	    Extension< GFqDom<long> > F121(F11, 2);
+	    F121.write(std::cout << "This is the field with 121 elements: ") << std::endl;
     }
 
-        // This is the field with 11^2=121 éléments
+        // This is the field with 11^2=121 elements
         // Using a polynomial representation
-        // And an alternative field, works only with Givaro >= 3.5.0
+        // And an alternative field, works only with Givaro >= 3.4.1
     {
-        
+
+        ZpzDom<Std64> F11(11);
+        Extension< ZpzDom<Std64> > F121(F11, 2);
+        F121.write(std::cout << "This is the field with 121 elements: ") << ", using: " << F121.irreducible() << " as irreducible polynomial" << std::endl;
+
+
+    }
+
+        // This is the field with 11^2=121 elements
+        // Using a polynomial representation
+        // And an alternative field, works only with Givaro >= 3.4.1
+    {
+
         ZpzDom<Std64> F11(11);
-        Extension< ZpzDom<Std64>  > F121(F11, 2);
-        F121.write(std::cout << "This is the field with 121 elements: ") << std::endl;
+        Poly1Dom< ZpzDom<Std64>, Dense > PolF11(F11,"Z");
+        Poly1Dom< ZpzDom<Std64>, Dense >::Element Irred;
+        PolF11.init(Irred, Degree(2));
+        F11.assign(Irred[0],F11.one);
+        F11.assign(Irred[1],F11.one); // Irred is Y^2+Y+1
+        Extension< ZpzDom<Std64> > F121(PolF11, Irred);
+        F121.write(std::cout << "This is the field with 121 elements: ") << ", using: " << F121.irreducible() << " as irreducible polynomial" << std::endl;
+
+
+    }
+
+
+        // This is the field with 2^8 elements
+    {
+        GFqDom<long> F256(2,8);
+        F256.write(std::cout << "This is the field with 256 elements: ") << ", using: " << F256.irreducible() << " as irreducible polynomial" << std::endl;
+    }
+
+        // This is the field with 2^8 elements
+        // Using 1 + x +x^3 +x^4 +x^8 as irreducible polynomial
+    {
+        std::vector< GFqDom<long>::Residu_t > Irred(9);
+        Irred[0] = 1; Irred[1] = 1; Irred[2] = 0; Irred[3] = 1;
+        Irred[4] = 1; Irred[5] = 0; Irred[6] = 0; Irred[7] = 0;
+        Irred[8] = 1;
+        GFqDom<long> F256(2,8, Irred);
+        F256.write(std::cout << "This is the field with 256 elements: ") << ", using: " << F256.irreducible() << " as irreducible polynomial" << std::endl;
+
+        std::cout << " this field is generated (in 2-adic) by: " << F256.generator() << std::endl;
+
+        std::cout << " in this field the indeterminate is represented by: " << F256.sage_generator() << std::endl;
+
+        {
+            GFqDom<long>::Element a, b, c;
+            givvector<long> Av(8); // A := X^7+X^6+X^3+X
+            Av[0]=0; Av[1]=1; Av[2]=0; Av[3]=1;
+            Av[4]=0; Av[5]=0; Av[6]=1; Av[7]=1;
+            givvector<long> Bv(8); // B:=X^6+X^4+X+1;
+            Bv[0]=1; Bv[1]=1; Bv[2]=0; Bv[3]=0;
+            Bv[4]=1; Bv[5]=0; Bv[6]=1; Bv[7]=0;
+
+            F256.init(a, Av); F256.init(b, Bv);
+
+            F256.mul(c,a,b);
+            F256.write( std::cout, a) << '*';
+            F256.write( std::cout, b) << '=';
+            F256.write( std::cout, c) << std::endl;
+
+
+            F256.add(c,a,b);
+            F256.write( F256.write( F256.write(
+                std::cout, a) << '+', b) << '=' , c ) << std::endl;
+        }
+
+        {
+            GFqDom<long>::Element a, b, c, x;
+            x = F256.sage_generator();
+
+            F256.add(a,x,F256.one); 	// X+1
+            F256.mulin(a,x);
+            F256.mulin(a,x);
+            F256.mulin(a,x); 		// (X+1)X^3
+            F256.addin(a,F256.one); 	// (X+1)X^3+1
+            F256.mulin(a,x);
+            F256.mulin(a,x); 		// ((X+1)X^3+1)X^2
+            F256.addin(a,F256.one); 	// ((X+1)X^3+1)X^2+1
+            F256.mulin(a,x); 		// (((X+1)X^3+1)X^2+1)X
+
+
+            F256.mul(b,x,x);
+            F256.addin(b,F256.one); 	// X^2+1
+            F256.mulin(b,x);
+            F256.mulin(b,x);
+            F256.mulin(b,x); 		// (X^2+1)X^3
+            F256.addin(b,F256.one); 	// (X^2+1)X^3+1
+            F256.mulin(b,x);		// ((X^2+1)X^3+1)X
+            F256.addin(b,F256.one); 	// ((X^2+1)X^3+1)X+1
+
+            F256.mul(c,a,b);
+            F256.write( std::cout, a) << '*';
+            F256.write( std::cout, b) << '=';
+            F256.write( std::cout, c) << std::endl;
+
+
+            F256.add(c,a,b);
+            F256.write( F256.write( F256.write(
+                std::cout, a) << '+', b) << '=' , c ) << std::endl;
+        }
+
+        {
+            ZpzDom<Std16> F2(2);
+            Poly1PadicDom< ZpzDom<Std16> > P2(F2,"X");
+
+            givvector<long> vect202; P2.radixdirect(vect202, 202, 8);
+            givvector<long> vect83; P2.radixdirect(vect83, 83, 8);
+
+            givvector< unsigned long > Irred2; P2.radixdirect(Irred2, 283, 9);
+            GFqDom<long> F256_(2,8, Irred2);
+
+
+            GFqDom<long>::Element a, b, c;
+            F256_.init(a, vect202); F256_.init(b, vect83);
+
+            F256_.mul(c,a,b);
+            F256_.write( std::cout, a) << '*';
+            F256_.write( std::cout, b) << '=';
+            F256_.write( std::cout, c) << std::endl;
+
+
+            F256_.add(c,a,b);
+            F256_.write( F256_.write( F256_.write(
+                std::cout, a) << '+', b) << '=' , c ) << std::endl;
+
+        }
+
     }
 
 
diff --git a/examples/FiniteField/Makefile.am b/examples/FiniteField/Makefile.am
index 686384f..ed2bcd5 100755
--- a/examples/FiniteField/Makefile.am
+++ b/examples/FiniteField/Makefile.am
@@ -31,7 +31,7 @@ OPTLINKS=
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
 AM_CPPFLAGS += $(OPTFLAGS) $(GMP_CFLAGS) -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/library/poly1 -I$(top_srcdir)/src/kernel/bstruct -I$(top_srcdir)/src/library/tools
 
-LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS=-static
 
 
@@ -52,5 +52,5 @@ exponentiation_SOURCES          = exponentiation.C
 # for compilation of new examples
 GIVARO_BIN=@bindir@
 %:%.C
-	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  $(shell $(GIVARO_BIN)/givaro-config --cflags ) $(LDADD)  $(shell $(GIVARO_BIN)/givaro-config --libs)
+	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  $(shell $(GIVARO_BIN)/givaro-config --cflags ) $(LDADD) $(shell $(GIVARO_BIN)/givaro-config --libs)
 
diff --git a/examples/FiniteField/Makefile.in b/examples/FiniteField/Makefile.in
index 94cd9be..640f2aa 100644
--- a/examples/FiniteField/Makefile.in
+++ b/examples/FiniteField/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,9 +15,27 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -54,54 +72,60 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am_GF128_OBJECTS = GF128.$(OBJEXT)
 GF128_OBJECTS = $(am_GF128_OBJECTS)
 GF128_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
-GF128_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+GF128_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_GFirreducible_OBJECTS = GFirreducible.$(OBJEXT)
 GFirreducible_OBJECTS = $(am_GFirreducible_OBJECTS)
 GFirreducible_LDADD = $(LDADD)
 GFirreducible_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_GaloisFields_OBJECTS = GaloisFields.$(OBJEXT)
 GaloisFields_OBJECTS = $(am_GaloisFields_OBJECTS)
 GaloisFields_LDADD = $(LDADD)
 GaloisFields_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_Test_Extension_OBJECTS = Test_Extension.$(OBJEXT)
 Test_Extension_OBJECTS = $(am_Test_Extension_OBJECTS)
 Test_Extension_LDADD = $(LDADD)
 Test_Extension_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_all_field_OBJECTS = all_field.$(OBJEXT)
 all_field_OBJECTS = $(am_all_field_OBJECTS)
 all_field_LDADD = $(LDADD)
-all_field_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+all_field_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_domain_to_operatorstyle_OBJECTS =  \
 	domain_to_operatorstyle.$(OBJEXT)
 domain_to_operatorstyle_OBJECTS =  \
 	$(am_domain_to_operatorstyle_OBJECTS)
 domain_to_operatorstyle_LDADD = $(LDADD)
 domain_to_operatorstyle_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_exponentiation_OBJECTS = exponentiation.$(OBJEXT)
 exponentiation_OBJECTS = $(am_exponentiation_OBJECTS)
 exponentiation_LDADD = $(LDADD)
 exponentiation_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_ff_arith_OBJECTS = ff_arith.$(OBJEXT)
 ff_arith_OBJECTS = $(am_ff_arith_OBJECTS)
 ff_arith_LDADD = $(LDADD)
-ff_arith_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ff_arith_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_gfq_atomic_OBJECTS = gfq_atomic.$(OBJEXT)
 gfq_atomic_OBJECTS = $(am_gfq_atomic_OBJECTS)
 gfq_atomic_LDADD = $(LDADD)
-gfq_atomic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+gfq_atomic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_zpz_atomic_OBJECTS = zpz_atomic.$(OBJEXT)
 zpz_atomic_OBJECTS = $(am_zpz_atomic_OBJECTS)
 zpz_atomic_LDADD = $(LDADD)
-zpz_atomic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+zpz_atomic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -124,6 +148,11 @@ DIST_SOURCES = $(GF128_SOURCES) $(GFirreducible_SOURCES) \
 	$(all_field_SOURCES) $(domain_to_operatorstyle_SOURCES) \
 	$(exponentiation_SOURCES) $(ff_arith_SOURCES) \
 	$(gfq_atomic_SOURCES) $(zpz_atomic_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -156,6 +185,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -191,6 +221,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -280,7 +311,7 @@ OPTLINKS =
 # icc for itanium2
 #OPTFLAGS+= -tpp2 -mcpu=itanium2
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
-LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS = -static
 CLEANFILES = $(EXTRA_PROGRAMS)
 GFirreducible_SOURCES = GFirreducible.C
@@ -309,9 +340,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps examples/FiniteField/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps examples/FiniteField/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps examples/FiniteField/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps examples/FiniteField/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -329,34 +360,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-GF128$(EXEEXT): $(GF128_OBJECTS) $(GF128_DEPENDENCIES) 
+$(am__aclocal_m4_deps):
+GF128$(EXEEXT): $(GF128_OBJECTS) $(GF128_DEPENDENCIES) $(EXTRA_GF128_DEPENDENCIES) 
 	@rm -f GF128$(EXEEXT)
 	$(CXXLINK) $(GF128_OBJECTS) $(GF128_LDADD) $(LIBS)
-GFirreducible$(EXEEXT): $(GFirreducible_OBJECTS) $(GFirreducible_DEPENDENCIES) 
+GFirreducible$(EXEEXT): $(GFirreducible_OBJECTS) $(GFirreducible_DEPENDENCIES) $(EXTRA_GFirreducible_DEPENDENCIES) 
 	@rm -f GFirreducible$(EXEEXT)
 	$(CXXLINK) $(GFirreducible_OBJECTS) $(GFirreducible_LDADD) $(LIBS)
-GaloisFields$(EXEEXT): $(GaloisFields_OBJECTS) $(GaloisFields_DEPENDENCIES) 
+GaloisFields$(EXEEXT): $(GaloisFields_OBJECTS) $(GaloisFields_DEPENDENCIES) $(EXTRA_GaloisFields_DEPENDENCIES) 
 	@rm -f GaloisFields$(EXEEXT)
 	$(CXXLINK) $(GaloisFields_OBJECTS) $(GaloisFields_LDADD) $(LIBS)
-Test_Extension$(EXEEXT): $(Test_Extension_OBJECTS) $(Test_Extension_DEPENDENCIES) 
+Test_Extension$(EXEEXT): $(Test_Extension_OBJECTS) $(Test_Extension_DEPENDENCIES) $(EXTRA_Test_Extension_DEPENDENCIES) 
 	@rm -f Test_Extension$(EXEEXT)
 	$(CXXLINK) $(Test_Extension_OBJECTS) $(Test_Extension_LDADD) $(LIBS)
-all_field$(EXEEXT): $(all_field_OBJECTS) $(all_field_DEPENDENCIES) 
+all_field$(EXEEXT): $(all_field_OBJECTS) $(all_field_DEPENDENCIES) $(EXTRA_all_field_DEPENDENCIES) 
 	@rm -f all_field$(EXEEXT)
 	$(CXXLINK) $(all_field_OBJECTS) $(all_field_LDADD) $(LIBS)
-domain_to_operatorstyle$(EXEEXT): $(domain_to_operatorstyle_OBJECTS) $(domain_to_operatorstyle_DEPENDENCIES) 
+domain_to_operatorstyle$(EXEEXT): $(domain_to_operatorstyle_OBJECTS) $(domain_to_operatorstyle_DEPENDENCIES) $(EXTRA_domain_to_operatorstyle_DEPENDENCIES) 
 	@rm -f domain_to_operatorstyle$(EXEEXT)
 	$(CXXLINK) $(domain_to_operatorstyle_OBJECTS) $(domain_to_operatorstyle_LDADD) $(LIBS)
-exponentiation$(EXEEXT): $(exponentiation_OBJECTS) $(exponentiation_DEPENDENCIES) 
+exponentiation$(EXEEXT): $(exponentiation_OBJECTS) $(exponentiation_DEPENDENCIES) $(EXTRA_exponentiation_DEPENDENCIES) 
 	@rm -f exponentiation$(EXEEXT)
 	$(CXXLINK) $(exponentiation_OBJECTS) $(exponentiation_LDADD) $(LIBS)
-ff_arith$(EXEEXT): $(ff_arith_OBJECTS) $(ff_arith_DEPENDENCIES) 
+ff_arith$(EXEEXT): $(ff_arith_OBJECTS) $(ff_arith_DEPENDENCIES) $(EXTRA_ff_arith_DEPENDENCIES) 
 	@rm -f ff_arith$(EXEEXT)
 	$(CXXLINK) $(ff_arith_OBJECTS) $(ff_arith_LDADD) $(LIBS)
-gfq_atomic$(EXEEXT): $(gfq_atomic_OBJECTS) $(gfq_atomic_DEPENDENCIES) 
+gfq_atomic$(EXEEXT): $(gfq_atomic_OBJECTS) $(gfq_atomic_DEPENDENCIES) $(EXTRA_gfq_atomic_DEPENDENCIES) 
 	@rm -f gfq_atomic$(EXEEXT)
 	$(CXXLINK) $(gfq_atomic_OBJECTS) $(gfq_atomic_LDADD) $(LIBS)
-zpz_atomic$(EXEEXT): $(zpz_atomic_OBJECTS) $(zpz_atomic_DEPENDENCIES) 
+zpz_atomic$(EXEEXT): $(zpz_atomic_OBJECTS) $(zpz_atomic_DEPENDENCIES) $(EXTRA_zpz_atomic_DEPENDENCIES) 
 	@rm -f zpz_atomic$(EXEEXT)
 	$(CXXLINK) $(zpz_atomic_OBJECTS) $(zpz_atomic_LDADD) $(LIBS)
 
@@ -393,7 +425,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -401,29 +433,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -444,13 +481,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -468,10 +509,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -479,6 +525,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -574,7 +621,8 @@ uninstall-am:
 # see the COPYRIGHT file for more details.
 all: $(EXTRA_PROGRAMS)
 %:%.C
-	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  $(shell $(GIVARO_BIN)/givaro-config --cflags ) $(LDADD)  $(shell $(GIVARO_BIN)/givaro-config --libs)
+	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  $(shell $(GIVARO_BIN)/givaro-config --cflags ) $(LDADD) $(shell $(GIVARO_BIN)/givaro-config --libs)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/examples/FiniteField/Test_Extension.C b/examples/FiniteField/Test_Extension.C
index f75f420..0a5a1cc 100644
--- a/examples/FiniteField/Test_Extension.C
+++ b/examples/FiniteField/Test_Extension.C
@@ -10,7 +10,6 @@
  * @brief NO DOC
  */
 
-using namespace std;
 #include "givaro/givpoly1.h"
 #include "givaro/givextension.h"
 
@@ -22,7 +21,7 @@ using namespace Givaro;
 template<class FField>
 void FaireEssai(const FField & F) {
 
-  F.write( cout << "Working in : " ) << endl;
+  F.write( std::cout << "Working in : " ) << std::endl;
 
   typename FField::Element a, b, r;
 
@@ -32,7 +31,7 @@ void FaireEssai(const FField & F) {
 
   F.add(r, a, b);
 
-  F.write( F.write( F.write( F.write(std::cout, a) << " + " , b ) << " = " , r) << " with ") << endl ;
+  F.write( F.write( F.write( F.write(std::cout, a) << " + " , b ) << " = " , r) << " with ") << std::endl ;
 
 }
 
@@ -40,15 +39,16 @@ void FaireEssai(const FField & F) {
 
 int main (int argc, char * * argv) {
 
-    unsigned long q = (argc>1?atoi(argv[1]):13);
-    unsigned long expo = (argc>2?atoi(argv[2]):8);
+    unsigned long q = (argc>1?(unsigned long)atoi(argv[1]):13);
+    unsigned long expo = (argc>2?(unsigned long)atoi(argv[2]):8);
 
     GFqDom<long> Toto(q,1);
-    Toto.write( cout << "This is ") << endl ;
+    Toto.write( std::cout << "This is ") << std::endl ;
     FaireEssai( Toto );
 
-    cerr << "Exponent max for zech logs " << q << "^" << expo << " : " << FF_EXPONENT_MAX(q,expo) << endl;
-    cerr << "NEED polynomial representation : " << NEED_POLYNOMIAL_REPRESENTATION(q,expo) << endl;
+    std::cerr << "Exponent max for zech logs with characteristic " << q << " : " << FF_EXPONENT_MAX(q,expo) << std::endl;
+    std::cerr << "Sub-Exponent max for zech logs " << q << "^" << expo << " : " << FF_SUBEXPONENT_MAX(q,expo) << std::endl;
+    std::cerr << "NEED polynomial representation : " << NEED_POLYNOMIAL_REPRESENTATION(q,expo) << std::endl;
     if ( NEED_POLYNOMIAL_REPRESENTATION(q,expo) )
         FaireEssai( Extension<>(q, expo) );
     else
diff --git a/examples/FiniteField/all_field.C b/examples/FiniteField/all_field.C
index 158a9bd..a8a5f36 100644
--- a/examples/FiniteField/all_field.C
+++ b/examples/FiniteField/all_field.C
@@ -20,7 +20,7 @@
 using namespace Givaro;
 
 
-
+namespace Givaro {
 // Domain kind
 typedef ZpzDom<Unsigned32>	Field1;	typedef StaticElement< Field1 > Element1; 	template<> Field1 Element1::_domain(2);
 typedef GFqDom<long>		Field2;	typedef StaticElement< Field2 > Element2;	template<> Field2 Element2::_domain(2);
@@ -30,8 +30,11 @@ typedef ZpzDom<Std32>		Field5;	typedef StaticElement< Field5 > Element5; 	templa
 typedef ZpzDom<Std16>		Field6;	typedef StaticElement< Field6 > Element6; 	template<> Field6 Element6::_domain(2);
 typedef ZpzDom<Log16>		Field7;	typedef StaticElement< Field7 > Element7; 	template<> Field7 Element7::_domain(2);
 #ifdef GIVARO_USE_SIXTYFOUR
-typedef ZpzDom<Std64>		Field8;	typedef StaticElement< Field8 > Element8; 	template<> Field8 Element8::_domain(2);
+typedef ZpzDom<Std64>		Field8;	typedef StaticElement< Field8 > Element8;
+template<>
+Field8 Element8::_domain(2);
 #endif
+}
 
 
 
@@ -41,7 +44,7 @@ void TestField()
     unsigned long P = 251;
 
         // Initialization of static member
-    Element::setDomain( Field( typename Field::Element(P)) );
+    Element::setDomain( Field( typename Field::Residu_t(P)) );
 
         // Initialisations of elements
     Element a(2),b(-29.8),c(33),d(Integer("123456789012345678901234567890")),e(0);
diff --git a/examples/FiniteField/domain_to_operatorstyle.C b/examples/FiniteField/domain_to_operatorstyle.C
index 2fce98f..3a2e017 100644
--- a/examples/FiniteField/domain_to_operatorstyle.C
+++ b/examples/FiniteField/domain_to_operatorstyle.C
@@ -17,20 +17,25 @@
 
 using namespace Givaro;
 
+namespace Givaro
+{
 
+	// Finite Field with Domain style
+	typedef GFqDom<long> Field;
 
-// Finite Field with Domain style
-typedef GFqDom<long> Field;
+	// Wrapper to give an operator style to the elements
+	typedef StaticElement< Field > Element;
 
-// Wrapper to give an operator style to the elements
-typedef StaticElement< Field > Element;
+	// Mandatory declaration (because of static template)
+	// and an actual constructed field is mandatory (the "(2)") for g++ 3.4
 
-// Mandatory declaration (because of static template)
-// and an actual constructed field is mandatory (the "(2)") for g++ 3.4
-template<> Field Element::_domain(2);
+	//! Specialisation of...
+	template<>
+	Field Element::_domain(2);
+}
 
 int main(int argc, char ** argv) {
-    unsigned long P = (argc>1 ? atoi(argv[1]) : 5009);
+    unsigned long P = (argc>1 ? (unsigned long)atoi(argv[1]) : 5009UL);
 
         // Initialization of static member
     Element::setDomain( Field(P) );
@@ -71,3 +76,5 @@ int main(int argc, char ** argv) {
 
     return 0;
 }
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/examples/FiniteField/exponentiation.C b/examples/FiniteField/exponentiation.C
index a2ef967..ce8d0ba 100644
--- a/examples/FiniteField/exponentiation.C
+++ b/examples/FiniteField/exponentiation.C
@@ -7,7 +7,7 @@
 /*! @file examples/FiniteField/exponentiation.C
  * @ingroup examples
  * @ingroup finitefields
- * @example examples/FiniteField/exponentation.C
+ * @example examples/FiniteField/exponentiation.C
  * @brief NO DOC
  */
 
@@ -41,8 +41,9 @@ int main(int argc, char ** argv) {
 
 
  {
+	 typedef GFqDom<int>::Residu_t TT;
     int Mod = 13; int exponent = 1;
-    GFqDom<int> GF13( Mod, exponent );  // finite field with 13 elements
+    GFqDom<int> GF13( (TT) Mod, (TT) exponent );  // finite field with 13 elements
     GFqDom<int>::Element a, c;
 
     GF13.init(a, 7);    // 7 modulo   13
diff --git a/examples/FiniteField/ff_arith.C b/examples/FiniteField/ff_arith.C
index ceb71c6..62ab072 100644
--- a/examples/FiniteField/ff_arith.C
+++ b/examples/FiniteField/ff_arith.C
@@ -174,6 +174,14 @@ int main(int argc, char ** argv) {
         // Zech log finite field with 5^4 elements
     GFqDom<int> GF625( 5, 4 ); TestField( GF625 );
 
+        // Zech log finite field with 256 elements
+        // and prescribed irreducible polynomial
+    std::vector< GFqDom<long>::Residu_t > Irred(9);
+    Irred[0] = 1; Irred[1] = 1; Irred[2] = 0; Irred[3] = 1;
+    Irred[4] = 1; Irred[5] = 0; Irred[6] = 0; Irred[7] = 0;
+    Irred[8] = 1;
+    GFqDom<long> F256(2,8, Irred); TestField( F256 );
+
         // Zech log finite field with 3^4 elements
         // Using the Q-adic Transform
     GFqExt<int> GF81( 3, 4 ); TestField( GF81 );
@@ -185,7 +193,7 @@ int main(int argc, char ** argv) {
     double tim = (double) tmp1.ru_utime.tv_sec + ((double) tmp1.ru_utime.tv_usec)/ ( 1000000.0 ) ;
 		    ;
 #ifndef __GIVARO__DONOTUSE_longlong__
-    GFqDom<long long> GF2M( 2, (argc > 1 ? atoi(argv[1]) : 20) );
+    GFqDom<long long> GF2M( 2, (argc > 1 ? (GFqDom<long long>::Residu_t) atoi(argv[1]) : 20) );
 #else
     GFqDom<long> GF2M( 2, (argc > 1 ? atoi(argv[1]) : 20) );
 #endif
diff --git a/examples/FiniteField/gfq_atomic.C b/examples/FiniteField/gfq_atomic.C
index eedb36f..3f584f4 100644
--- a/examples/FiniteField/gfq_atomic.C
+++ b/examples/FiniteField/gfq_atomic.C
@@ -48,7 +48,7 @@ int main(int argc, char ** argv)
 	Timer inver;
 	inver.clear();
 	inver.start();
-	Domain GFq(P, expo);  // Buiding of finite field with P^expo Elements
+	Domain GFq((unsigned long)P, (unsigned long)expo);  // Buiding of finite field with P^expo Elements
 
 	int i;
 	std::cout << "."<< std::flush;
diff --git a/examples/FiniteField/zpz_atomic.C b/examples/FiniteField/zpz_atomic.C
index d9f673c..8e77302 100644
--- a/examples/FiniteField/zpz_atomic.C
+++ b/examples/FiniteField/zpz_atomic.C
@@ -49,7 +49,7 @@ int main(int argc, char ** argv)
     Timer inver;
     inver.clear();
     inver.start();
-    Domain GFq((Domain::Element)P);
+    Domain GFq((Domain::Residu_t)P);
 
     int i;
     std::cout << "."<< std::flush;
diff --git a/examples/Integer/Makefile.am b/examples/Integer/Makefile.am
index 92ca5b9..03cf702 100755
--- a/examples/Integer/Makefile.am
+++ b/examples/Integer/Makefile.am
@@ -25,9 +25,9 @@ AM_CPPFLAGS=-I$(top_srcdir)
 
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
 AM_CPPFLAGS += $(OPTFLAGS) $(GMP_CFLAGS)
-AM_CPPFLAGS += -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/bstruct
+AM_CPPFLAGS += -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/bstruct -I$(top_srcdir)/src/library/poly1 -I$(top_srcdir)/src/library/tools
 
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS=-static
 
 EXTRA_PROGRAMS=ifactor ifactor_lenstra igcd igcdext ilcm isproot nb_primes isprime nextprime order prevprime RSA_breaking RSA_keys_generator primitiveroot primitiveelement phi lambda lambda_inv iexponentiation RSA_decipher  RSA_encipher  ispower probable_primroot ProbLucas ModularSquareRoot
diff --git a/examples/Integer/Makefile.in b/examples/Integer/Makefile.in
index d85fcc6..f6c7773 100644
--- a/examples/Integer/Makefile.in
+++ b/examples/Integer/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,9 +15,27 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -60,107 +78,118 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am_ModularSquareRoot_OBJECTS = ModularSquareRoot.$(OBJEXT)
 ModularSquareRoot_OBJECTS = $(am_ModularSquareRoot_OBJECTS)
 ModularSquareRoot_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
-ModularSquareRoot_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ModularSquareRoot_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_ProbLucas_OBJECTS = ProbLucas.$(OBJEXT)
 ProbLucas_OBJECTS = $(am_ProbLucas_OBJECTS)
 ProbLucas_LDADD = $(LDADD)
-ProbLucas_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ProbLucas_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_RSA_breaking_OBJECTS = RSA_breaking.$(OBJEXT)
 RSA_breaking_OBJECTS = $(am_RSA_breaking_OBJECTS)
 RSA_breaking_LDADD = $(LDADD)
-RSA_breaking_DEPENDENCIES = $(am__DEPENDENCIES_1)
+RSA_breaking_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_RSA_decipher_OBJECTS = RSA_decipher.$(OBJEXT)
 RSA_decipher_OBJECTS = $(am_RSA_decipher_OBJECTS)
 RSA_decipher_LDADD = $(LDADD)
-RSA_decipher_DEPENDENCIES = $(am__DEPENDENCIES_1)
+RSA_decipher_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_RSA_encipher_OBJECTS = RSA_encipher.$(OBJEXT)
 RSA_encipher_OBJECTS = $(am_RSA_encipher_OBJECTS)
 RSA_encipher_LDADD = $(LDADD)
-RSA_encipher_DEPENDENCIES = $(am__DEPENDENCIES_1)
+RSA_encipher_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_RSA_keys_generator_OBJECTS = RSA_keys_generator.$(OBJEXT)
 RSA_keys_generator_OBJECTS = $(am_RSA_keys_generator_OBJECTS)
 RSA_keys_generator_LDADD = $(LDADD)
-RSA_keys_generator_DEPENDENCIES = $(am__DEPENDENCIES_1)
+RSA_keys_generator_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_iexponentiation_OBJECTS = iexponentiation.$(OBJEXT)
 iexponentiation_OBJECTS = $(am_iexponentiation_OBJECTS)
 iexponentiation_LDADD = $(LDADD)
-iexponentiation_DEPENDENCIES = $(am__DEPENDENCIES_1)
+iexponentiation_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_ifactor_OBJECTS = ifactor.$(OBJEXT)
 ifactor_OBJECTS = $(am_ifactor_OBJECTS)
 ifactor_LDADD = $(LDADD)
-ifactor_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ifactor_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_ifactor_lenstra_OBJECTS = ifactor_lenstra.$(OBJEXT)
 ifactor_lenstra_OBJECTS = $(am_ifactor_lenstra_OBJECTS)
 ifactor_lenstra_LDADD = $(LDADD)
-ifactor_lenstra_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ifactor_lenstra_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_igcd_OBJECTS = igcd.$(OBJEXT)
 igcd_OBJECTS = $(am_igcd_OBJECTS)
 igcd_LDADD = $(LDADD)
-igcd_DEPENDENCIES = $(am__DEPENDENCIES_1)
+igcd_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_igcdext_OBJECTS = igcdext.$(OBJEXT)
 igcdext_OBJECTS = $(am_igcdext_OBJECTS)
 igcdext_LDADD = $(LDADD)
-igcdext_DEPENDENCIES = $(am__DEPENDENCIES_1)
+igcdext_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_ilcm_OBJECTS = ilcm.$(OBJEXT)
 ilcm_OBJECTS = $(am_ilcm_OBJECTS)
 ilcm_LDADD = $(LDADD)
-ilcm_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ilcm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_ispower_OBJECTS = ispower.$(OBJEXT)
 ispower_OBJECTS = $(am_ispower_OBJECTS)
 ispower_LDADD = $(LDADD)
-ispower_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ispower_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_isprime_OBJECTS = isprime.$(OBJEXT)
 isprime_OBJECTS = $(am_isprime_OBJECTS)
 isprime_LDADD = $(LDADD)
-isprime_DEPENDENCIES = $(am__DEPENDENCIES_1)
+isprime_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_isproot_OBJECTS = isproot.$(OBJEXT)
 isproot_OBJECTS = $(am_isproot_OBJECTS)
 isproot_LDADD = $(LDADD)
-isproot_DEPENDENCIES = $(am__DEPENDENCIES_1)
+isproot_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_lambda_OBJECTS = lambda.$(OBJEXT)
 lambda_OBJECTS = $(am_lambda_OBJECTS)
 lambda_LDADD = $(LDADD)
-lambda_DEPENDENCIES = $(am__DEPENDENCIES_1)
+lambda_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_lambda_inv_OBJECTS = lambda_inv.$(OBJEXT)
 lambda_inv_OBJECTS = $(am_lambda_inv_OBJECTS)
 lambda_inv_LDADD = $(LDADD)
-lambda_inv_DEPENDENCIES = $(am__DEPENDENCIES_1)
+lambda_inv_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_nb_primes_OBJECTS = nb_primes.$(OBJEXT)
 nb_primes_OBJECTS = $(am_nb_primes_OBJECTS)
 nb_primes_LDADD = $(LDADD)
-nb_primes_DEPENDENCIES = $(am__DEPENDENCIES_1)
+nb_primes_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_nextprime_OBJECTS = nextprime.$(OBJEXT)
 nextprime_OBJECTS = $(am_nextprime_OBJECTS)
 nextprime_LDADD = $(LDADD)
-nextprime_DEPENDENCIES = $(am__DEPENDENCIES_1)
+nextprime_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_order_OBJECTS = order.$(OBJEXT)
 order_OBJECTS = $(am_order_OBJECTS)
 order_LDADD = $(LDADD)
-order_DEPENDENCIES = $(am__DEPENDENCIES_1)
+order_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_phi_OBJECTS = phi.$(OBJEXT)
 phi_OBJECTS = $(am_phi_OBJECTS)
 phi_LDADD = $(LDADD)
-phi_DEPENDENCIES = $(am__DEPENDENCIES_1)
+phi_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_prevprime_OBJECTS = prevprime.$(OBJEXT)
 prevprime_OBJECTS = $(am_prevprime_OBJECTS)
 prevprime_LDADD = $(LDADD)
-prevprime_DEPENDENCIES = $(am__DEPENDENCIES_1)
+prevprime_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_primitiveelement_OBJECTS = primitiveelement.$(OBJEXT)
 primitiveelement_OBJECTS = $(am_primitiveelement_OBJECTS)
 primitiveelement_LDADD = $(LDADD)
-primitiveelement_DEPENDENCIES = $(am__DEPENDENCIES_1)
+primitiveelement_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_primitiveroot_OBJECTS = primitiveroot.$(OBJEXT)
 primitiveroot_OBJECTS = $(am_primitiveroot_OBJECTS)
 primitiveroot_LDADD = $(LDADD)
-primitiveroot_DEPENDENCIES = $(am__DEPENDENCIES_1)
+primitiveroot_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_probable_primroot_OBJECTS = probable_primroot.$(OBJEXT)
 probable_primroot_OBJECTS = $(am_probable_primroot_OBJECTS)
 probable_primroot_LDADD = $(LDADD)
-probable_primroot_DEPENDENCIES = $(am__DEPENDENCIES_1)
+probable_primroot_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -195,6 +224,11 @@ DIST_SOURCES = $(ModularSquareRoot_SOURCES) $(ProbLucas_SOURCES) \
 	$(phi_SOURCES) $(prevprime_SOURCES) \
 	$(primitiveelement_SOURCES) $(primitiveroot_SOURCES) \
 	$(probable_primroot_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -227,6 +261,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -262,6 +297,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -327,7 +363,9 @@ AM_CPPFLAGS = -I$(top_srcdir) $(OPTFLAGS) $(GMP_CFLAGS) \
 	-I$(top_srcdir)/src/kernel/memory \
 	-I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel \
 	-I$(top_srcdir)/src/kernel/zpz \
-	-I$(top_srcdir)/src/kernel/bstruct
+	-I$(top_srcdir)/src/kernel/bstruct \
+	-I$(top_srcdir)/src/library/poly1 \
+	-I$(top_srcdir)/src/library/tools
 
 #OPTFLAGS = -O7 -funroll-all-loops -felide-constructors -fstrict-aliasing
 #OPTFLAGS+= -frerun-loop-opt -fexpensive-optimizations
@@ -345,7 +383,7 @@ AM_CPPFLAGS = -I$(top_srcdir) $(OPTFLAGS) $(GMP_CFLAGS) \
 # icc for itanium2
 #OPTFLAGS+= -tpp2 -mcpu=itanium2
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS = -static
 CLEANFILES = $(EXTRA_PROGRAMS)
 ModularSquareRoot_SOURCES = ModularSquareRoot.C
@@ -389,9 +427,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps examples/Integer/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps examples/Integer/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps examples/Integer/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps examples/Integer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -409,79 +447,80 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-ModularSquareRoot$(EXEEXT): $(ModularSquareRoot_OBJECTS) $(ModularSquareRoot_DEPENDENCIES) 
+$(am__aclocal_m4_deps):
+ModularSquareRoot$(EXEEXT): $(ModularSquareRoot_OBJECTS) $(ModularSquareRoot_DEPENDENCIES) $(EXTRA_ModularSquareRoot_DEPENDENCIES) 
 	@rm -f ModularSquareRoot$(EXEEXT)
 	$(CXXLINK) $(ModularSquareRoot_OBJECTS) $(ModularSquareRoot_LDADD) $(LIBS)
-ProbLucas$(EXEEXT): $(ProbLucas_OBJECTS) $(ProbLucas_DEPENDENCIES) 
+ProbLucas$(EXEEXT): $(ProbLucas_OBJECTS) $(ProbLucas_DEPENDENCIES) $(EXTRA_ProbLucas_DEPENDENCIES) 
 	@rm -f ProbLucas$(EXEEXT)
 	$(CXXLINK) $(ProbLucas_OBJECTS) $(ProbLucas_LDADD) $(LIBS)
-RSA_breaking$(EXEEXT): $(RSA_breaking_OBJECTS) $(RSA_breaking_DEPENDENCIES) 
+RSA_breaking$(EXEEXT): $(RSA_breaking_OBJECTS) $(RSA_breaking_DEPENDENCIES) $(EXTRA_RSA_breaking_DEPENDENCIES) 
 	@rm -f RSA_breaking$(EXEEXT)
 	$(CXXLINK) $(RSA_breaking_OBJECTS) $(RSA_breaking_LDADD) $(LIBS)
-RSA_decipher$(EXEEXT): $(RSA_decipher_OBJECTS) $(RSA_decipher_DEPENDENCIES) 
+RSA_decipher$(EXEEXT): $(RSA_decipher_OBJECTS) $(RSA_decipher_DEPENDENCIES) $(EXTRA_RSA_decipher_DEPENDENCIES) 
 	@rm -f RSA_decipher$(EXEEXT)
 	$(CXXLINK) $(RSA_decipher_OBJECTS) $(RSA_decipher_LDADD) $(LIBS)
-RSA_encipher$(EXEEXT): $(RSA_encipher_OBJECTS) $(RSA_encipher_DEPENDENCIES) 
+RSA_encipher$(EXEEXT): $(RSA_encipher_OBJECTS) $(RSA_encipher_DEPENDENCIES) $(EXTRA_RSA_encipher_DEPENDENCIES) 
 	@rm -f RSA_encipher$(EXEEXT)
 	$(CXXLINK) $(RSA_encipher_OBJECTS) $(RSA_encipher_LDADD) $(LIBS)
-RSA_keys_generator$(EXEEXT): $(RSA_keys_generator_OBJECTS) $(RSA_keys_generator_DEPENDENCIES) 
+RSA_keys_generator$(EXEEXT): $(RSA_keys_generator_OBJECTS) $(RSA_keys_generator_DEPENDENCIES) $(EXTRA_RSA_keys_generator_DEPENDENCIES) 
 	@rm -f RSA_keys_generator$(EXEEXT)
 	$(CXXLINK) $(RSA_keys_generator_OBJECTS) $(RSA_keys_generator_LDADD) $(LIBS)
-iexponentiation$(EXEEXT): $(iexponentiation_OBJECTS) $(iexponentiation_DEPENDENCIES) 
+iexponentiation$(EXEEXT): $(iexponentiation_OBJECTS) $(iexponentiation_DEPENDENCIES) $(EXTRA_iexponentiation_DEPENDENCIES) 
 	@rm -f iexponentiation$(EXEEXT)
 	$(CXXLINK) $(iexponentiation_OBJECTS) $(iexponentiation_LDADD) $(LIBS)
-ifactor$(EXEEXT): $(ifactor_OBJECTS) $(ifactor_DEPENDENCIES) 
+ifactor$(EXEEXT): $(ifactor_OBJECTS) $(ifactor_DEPENDENCIES) $(EXTRA_ifactor_DEPENDENCIES) 
 	@rm -f ifactor$(EXEEXT)
 	$(CXXLINK) $(ifactor_OBJECTS) $(ifactor_LDADD) $(LIBS)
-ifactor_lenstra$(EXEEXT): $(ifactor_lenstra_OBJECTS) $(ifactor_lenstra_DEPENDENCIES) 
+ifactor_lenstra$(EXEEXT): $(ifactor_lenstra_OBJECTS) $(ifactor_lenstra_DEPENDENCIES) $(EXTRA_ifactor_lenstra_DEPENDENCIES) 
 	@rm -f ifactor_lenstra$(EXEEXT)
 	$(CXXLINK) $(ifactor_lenstra_OBJECTS) $(ifactor_lenstra_LDADD) $(LIBS)
-igcd$(EXEEXT): $(igcd_OBJECTS) $(igcd_DEPENDENCIES) 
+igcd$(EXEEXT): $(igcd_OBJECTS) $(igcd_DEPENDENCIES) $(EXTRA_igcd_DEPENDENCIES) 
 	@rm -f igcd$(EXEEXT)
 	$(CXXLINK) $(igcd_OBJECTS) $(igcd_LDADD) $(LIBS)
-igcdext$(EXEEXT): $(igcdext_OBJECTS) $(igcdext_DEPENDENCIES) 
+igcdext$(EXEEXT): $(igcdext_OBJECTS) $(igcdext_DEPENDENCIES) $(EXTRA_igcdext_DEPENDENCIES) 
 	@rm -f igcdext$(EXEEXT)
 	$(CXXLINK) $(igcdext_OBJECTS) $(igcdext_LDADD) $(LIBS)
-ilcm$(EXEEXT): $(ilcm_OBJECTS) $(ilcm_DEPENDENCIES) 
+ilcm$(EXEEXT): $(ilcm_OBJECTS) $(ilcm_DEPENDENCIES) $(EXTRA_ilcm_DEPENDENCIES) 
 	@rm -f ilcm$(EXEEXT)
 	$(CXXLINK) $(ilcm_OBJECTS) $(ilcm_LDADD) $(LIBS)
-ispower$(EXEEXT): $(ispower_OBJECTS) $(ispower_DEPENDENCIES) 
+ispower$(EXEEXT): $(ispower_OBJECTS) $(ispower_DEPENDENCIES) $(EXTRA_ispower_DEPENDENCIES) 
 	@rm -f ispower$(EXEEXT)
 	$(CXXLINK) $(ispower_OBJECTS) $(ispower_LDADD) $(LIBS)
-isprime$(EXEEXT): $(isprime_OBJECTS) $(isprime_DEPENDENCIES) 
+isprime$(EXEEXT): $(isprime_OBJECTS) $(isprime_DEPENDENCIES) $(EXTRA_isprime_DEPENDENCIES) 
 	@rm -f isprime$(EXEEXT)
 	$(CXXLINK) $(isprime_OBJECTS) $(isprime_LDADD) $(LIBS)
-isproot$(EXEEXT): $(isproot_OBJECTS) $(isproot_DEPENDENCIES) 
+isproot$(EXEEXT): $(isproot_OBJECTS) $(isproot_DEPENDENCIES) $(EXTRA_isproot_DEPENDENCIES) 
 	@rm -f isproot$(EXEEXT)
 	$(CXXLINK) $(isproot_OBJECTS) $(isproot_LDADD) $(LIBS)
-lambda$(EXEEXT): $(lambda_OBJECTS) $(lambda_DEPENDENCIES) 
+lambda$(EXEEXT): $(lambda_OBJECTS) $(lambda_DEPENDENCIES) $(EXTRA_lambda_DEPENDENCIES) 
 	@rm -f lambda$(EXEEXT)
 	$(CXXLINK) $(lambda_OBJECTS) $(lambda_LDADD) $(LIBS)
-lambda_inv$(EXEEXT): $(lambda_inv_OBJECTS) $(lambda_inv_DEPENDENCIES) 
+lambda_inv$(EXEEXT): $(lambda_inv_OBJECTS) $(lambda_inv_DEPENDENCIES) $(EXTRA_lambda_inv_DEPENDENCIES) 
 	@rm -f lambda_inv$(EXEEXT)
 	$(CXXLINK) $(lambda_inv_OBJECTS) $(lambda_inv_LDADD) $(LIBS)
-nb_primes$(EXEEXT): $(nb_primes_OBJECTS) $(nb_primes_DEPENDENCIES) 
+nb_primes$(EXEEXT): $(nb_primes_OBJECTS) $(nb_primes_DEPENDENCIES) $(EXTRA_nb_primes_DEPENDENCIES) 
 	@rm -f nb_primes$(EXEEXT)
 	$(CXXLINK) $(nb_primes_OBJECTS) $(nb_primes_LDADD) $(LIBS)
-nextprime$(EXEEXT): $(nextprime_OBJECTS) $(nextprime_DEPENDENCIES) 
+nextprime$(EXEEXT): $(nextprime_OBJECTS) $(nextprime_DEPENDENCIES) $(EXTRA_nextprime_DEPENDENCIES) 
 	@rm -f nextprime$(EXEEXT)
 	$(CXXLINK) $(nextprime_OBJECTS) $(nextprime_LDADD) $(LIBS)
-order$(EXEEXT): $(order_OBJECTS) $(order_DEPENDENCIES) 
+order$(EXEEXT): $(order_OBJECTS) $(order_DEPENDENCIES) $(EXTRA_order_DEPENDENCIES) 
 	@rm -f order$(EXEEXT)
 	$(CXXLINK) $(order_OBJECTS) $(order_LDADD) $(LIBS)
-phi$(EXEEXT): $(phi_OBJECTS) $(phi_DEPENDENCIES) 
+phi$(EXEEXT): $(phi_OBJECTS) $(phi_DEPENDENCIES) $(EXTRA_phi_DEPENDENCIES) 
 	@rm -f phi$(EXEEXT)
 	$(CXXLINK) $(phi_OBJECTS) $(phi_LDADD) $(LIBS)
-prevprime$(EXEEXT): $(prevprime_OBJECTS) $(prevprime_DEPENDENCIES) 
+prevprime$(EXEEXT): $(prevprime_OBJECTS) $(prevprime_DEPENDENCIES) $(EXTRA_prevprime_DEPENDENCIES) 
 	@rm -f prevprime$(EXEEXT)
 	$(CXXLINK) $(prevprime_OBJECTS) $(prevprime_LDADD) $(LIBS)
-primitiveelement$(EXEEXT): $(primitiveelement_OBJECTS) $(primitiveelement_DEPENDENCIES) 
+primitiveelement$(EXEEXT): $(primitiveelement_OBJECTS) $(primitiveelement_DEPENDENCIES) $(EXTRA_primitiveelement_DEPENDENCIES) 
 	@rm -f primitiveelement$(EXEEXT)
 	$(CXXLINK) $(primitiveelement_OBJECTS) $(primitiveelement_LDADD) $(LIBS)
-primitiveroot$(EXEEXT): $(primitiveroot_OBJECTS) $(primitiveroot_DEPENDENCIES) 
+primitiveroot$(EXEEXT): $(primitiveroot_OBJECTS) $(primitiveroot_DEPENDENCIES) $(EXTRA_primitiveroot_DEPENDENCIES) 
 	@rm -f primitiveroot$(EXEEXT)
 	$(CXXLINK) $(primitiveroot_OBJECTS) $(primitiveroot_LDADD) $(LIBS)
-probable_primroot$(EXEEXT): $(probable_primroot_OBJECTS) $(probable_primroot_DEPENDENCIES) 
+probable_primroot$(EXEEXT): $(probable_primroot_OBJECTS) $(probable_primroot_DEPENDENCIES) $(EXTRA_probable_primroot_DEPENDENCIES) 
 	@rm -f probable_primroot$(EXEEXT)
 	$(CXXLINK) $(probable_primroot_OBJECTS) $(probable_primroot_LDADD) $(LIBS)
 
@@ -518,7 +557,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -526,29 +565,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -569,13 +613,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -593,10 +641,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -604,6 +657,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -700,6 +754,7 @@ uninstall-am:
 all: $(EXTRA_PROGRAMS)
 %:%.C
 	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs`
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/examples/Integer/ModularSquareRoot.C b/examples/Integer/ModularSquareRoot.C
index 5ed3b51..6d70d3e 100644
--- a/examples/Integer/ModularSquareRoot.C
+++ b/examples/Integer/ModularSquareRoot.C
@@ -4,7 +4,7 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Time-stamp: <11 Dec 09 21:07:13 Jean-Guillaume.Dumas at imag.fr>
+// Time-stamp: <21 Feb 12 17:02:32 Jean-Guillaume.Dumas at imag.fr>
 // Givaro : Modular square roots
 // =================================================================== //
 
@@ -19,6 +19,9 @@
 #include <givaro/givintsqrootmod.h>
 #include <givaro/givtimer.h>
 
+
+#include <givaro/givpoly1factor.h>
+#include <givaro/givzpzInt.h>
 using namespace Givaro;
 
 
@@ -30,11 +33,14 @@ using namespace Givaro;
 int main(int argc, char** argv)
 {
     Integer a(argv[1]), n(argv[2]);
-    std::cerr << "n: " << n << std::endl;
+    IntSqrtModDom<> ISM;
+    
+    {
+        
     std::cerr << "a: " << a << std::endl;
+    std::cerr << "n: " << n << std::endl;
 
-    Integer::seeding (BaseTimer::seed ());
-    IntSqrtModDom<> ISM;
+    Integer::seeding ( (unsigned long)BaseTimer::seed ());
 
     Integer r;
     Timer chrono; chrono.start();
@@ -44,6 +50,39 @@ int main(int argc, char** argv)
     std::cerr << chrono << std::endl;
 
     std::cerr << "Check, (" << r << ")^2 mod " << n << " = " << ( (r*r)%n) << std::endl;
+    }
+    
+    if (ISM.isprime(n)) {
+        std::cout << "Using polynomial factorization : " << std::endl;
+        typedef ZpzDom<Integer> Field;
+        typedef Poly1FactorDom<Field,Dense> Polys;
+        typedef Polys::Element Polynomial;
+        Field F(n); Polys Pol(F, "X");
+        
+        Polynomial quad, root;
+        Pol.init(quad, Degree(2));
+        F.init(quad[0],a); F.negin(quad[0]);
+        
+        Timer chrono; chrono.start();
+        if (Pol.is_irreducible(quad)) {
+            std::cerr << a << " is not a quadratic residue mod " << n << std::endl;
+            chrono.stop();
+            std::cerr << chrono << std::endl;
+            return 0;
+        }
+        
+        Pol.SplitFactor(root, quad, Degree(1));        
+        chrono.stop();
+
+        Pol.divin(root, root[1]);
+        
+
+        Pol.write(std::cout, root) << std::endl;
+        std::cerr << chrono << std::endl;
+
+        std::cerr << "Check, (" << root[0] << ")^2 mod " << n << " = " << ( (root[0]*root[0])%n) << std::endl;
+    }
+    
 
     return 0;
 }
diff --git a/examples/Integer/ProbLucas.C b/examples/Integer/ProbLucas.C
index f65ca19..4e0d6d2 100644
--- a/examples/Integer/ProbLucas.C
+++ b/examples/Integer/ProbLucas.C
@@ -125,7 +125,7 @@ unsigned long Revert(const Integer p, const double epsilon)
 bool ProbLucas(const Integer n, const double orig_epsilon)
 {
 #ifdef __GMP_PLUSPLUS__
-	Integer::seeding( BaseTimer::seed() );
+	Integer::seeding( (unsigned long)BaseTimer::seed() );
 #endif
 	GivRandom generator;
 
@@ -246,7 +246,7 @@ int main (int argc, char * * argv)
 	Integer P;
 	if (argc > 1) P = Integer(argv[1]); else std::cin >> P;
 	double epsilon = argc > 2 ? atof(argv[2]) : 0.000001;
-	unsigned int NB = argc > 3 ? atoi(argv[3]) : 1;
+	unsigned int NB = argc > 3 ? (unsigned int)atoi(argv[3]) : 1U;
 
 	//    std::cerr << "P: " << P << " ; proba: " << epsilon << std::endl;
 
diff --git a/examples/Integer/iexponentiation.C b/examples/Integer/iexponentiation.C
index a8145ae..4f1a189 100644
--- a/examples/Integer/iexponentiation.C
+++ b/examples/Integer/iexponentiation.C
@@ -28,12 +28,12 @@ int main(int argc, char ** argv) {
  {
     ZpzDom<Integer>::Element a, b, p(argv[3]);
     ZpzDom<Integer> Zp( p );
-    unsigned long e = atoi(argv[2]) ;
+    unsigned long e = (unsigned long)atoi(argv[2]) ;
     Zp.init(a, Integer(argv[1]));
     Zp.init(b);
 
     Timer tim;tim.clear();tim.start();
-    dom_power(b, a, e, Zp);
+    dom_power(b, a, (long)e, Zp);
     tim.stop();
 
     Zp.write( std::cout, a) << " ^ " << e << " % " << p << " = " << std::flush;
diff --git a/examples/Integer/ispower.C b/examples/Integer/ispower.C
index d8da725..65b5111 100644
--- a/examples/Integer/ispower.C
+++ b/examples/Integer/ispower.C
@@ -36,7 +36,7 @@ int main(int argc, char** argv)
     }
     {
         Timer tim; tim.clear(); tim.start();
-        int a = IP.isprimepower(p, m);
+        int a = (int)IP.isprimepower(p, m);
         tim.stop();
         if (a) std::cout << "is " << p << "^" << a << std::endl;
         else   std::cout << "not a prime power" << std::endl;
diff --git a/examples/Integer/isprime.C b/examples/Integer/isprime.C
index cf0a073..245b0e8 100644
--- a/examples/Integer/isprime.C
+++ b/examples/Integer/isprime.C
@@ -31,10 +31,10 @@ int main(int argc, char** argv)
   IntPrimeDom IP;
   IntPrimeDom::Element m;
   if (argc > 1) m = Integer(argv[1]);
-  unsigned int r = argc > 2 ? atoi(argv[2]) : 5;
+  unsigned int r = argc > 2 ? (unsigned int)atoi(argv[2]) : 5;
 
         Timer tim; tim.clear(); tim.start();
-        bool a = IP.isprime(m,r);
+        bool a = IP.isprime(m,(int)r);
         tim.stop();
         cout << (a?"true":"false") << endl;
         cerr << tim << endl;
diff --git a/examples/Integer/probable_primroot.C b/examples/Integer/probable_primroot.C
index e59c128..eb63ca5 100644
--- a/examples/Integer/probable_primroot.C
+++ b/examples/Integer/probable_primroot.C
@@ -29,7 +29,7 @@ int main(int argc, char** argv)
 {
     IntNumTheoDom<> IP;
 #ifdef __GMP_PLUSPLUS__
-    IP.seeding( BaseTimer::seed() );
+    IP.seeding( (unsigned long)BaseTimer::seed() );
 #endif
 
     double error;
diff --git a/examples/Makefile.am b/examples/Makefile.am
index aea0800..d348b03 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -13,4 +13,4 @@ SUBDIRS=Rational Integer FiniteField Polynomial
 examples: $(SUBDIRS)
 
 $(SUBDIRS):
-	make -C $@
+	$(MAKE) -C $@
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 47ac49d..9900bc5 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 #  all all-local: $(none)
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -58,6 +76,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
@@ -69,12 +88,45 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -104,6 +156,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -139,6 +192,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -212,9 +266,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps examples/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps examples/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps examples/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps examples/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -232,6 +286,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -263,7 +318,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -297,16 +352,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -321,7 +376,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -333,7 +388,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -342,29 +397,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -385,29 +445,41 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -427,16 +499,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -507,8 +585,8 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic clean-libtool \
@@ -530,7 +608,8 @@ uninstall-am:
 examples: $(SUBDIRS)
 
 $(SUBDIRS):
-	make -C $@
+	$(MAKE) -C $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/examples/Polynomial/Makefile.am b/examples/Polynomial/Makefile.am
index fbc5bc0..2152bbc 100755
--- a/examples/Polynomial/Makefile.am
+++ b/examples/Polynomial/Makefile.am
@@ -26,7 +26,7 @@ AM_CPPFLAGS=-I$(top_srcdir)
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
 AM_CPPFLAGS += $(OPTFLAGS) $(GMP_CFLAGS) -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/library/poly1 -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/bstruct -I$(top_srcdir)/src/kernel/rational -I$(top_srcdir)/src/library/tools
 
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS=-static
 
 
@@ -47,4 +47,4 @@ highorder_SOURCES     = highorder.C
 # for compilation of new examples
 GIVARO_BIN=@bindir@
 %:%.C
-	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs`
+	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)    `$(GIVARO_BIN)/givaro-config --libs`
diff --git a/examples/Polynomial/Makefile.in b/examples/Polynomial/Makefile.in
index 88cf0bc..258a714 100644
--- a/examples/Polynomial/Makefile.in
+++ b/examples/Polynomial/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,9 +15,27 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -54,43 +72,45 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am_PolynomialCRT_OBJECTS = PolynomialCRT.$(OBJEXT)
 PolynomialCRT_OBJECTS = $(am_PolynomialCRT_OBJECTS)
 PolynomialCRT_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
-PolynomialCRT_DEPENDENCIES = $(am__DEPENDENCIES_1)
+PolynomialCRT_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_highorder_OBJECTS = highorder.$(OBJEXT)
 highorder_OBJECTS = $(am_highorder_OBJECTS)
 highorder_LDADD = $(LDADD)
-highorder_DEPENDENCIES = $(am__DEPENDENCIES_1)
+highorder_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_interpolate_OBJECTS = interpolate.$(OBJEXT)
 interpolate_OBJECTS = $(am_interpolate_OBJECTS)
 interpolate_LDADD = $(LDADD)
-interpolate_DEPENDENCIES = $(am__DEPENDENCIES_1)
+interpolate_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_isirred_OBJECTS = isirred.$(OBJEXT)
 isirred_OBJECTS = $(am_isirred_OBJECTS)
 isirred_LDADD = $(LDADD)
-isirred_DEPENDENCIES = $(am__DEPENDENCIES_1)
+isirred_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_isprimitive_OBJECTS = isprimitive.$(OBJEXT)
 isprimitive_OBJECTS = $(am_isprimitive_OBJECTS)
 isprimitive_LDADD = $(LDADD)
-isprimitive_DEPENDENCIES = $(am__DEPENDENCIES_1)
+isprimitive_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_pol_arith_OBJECTS = pol_arith.$(OBJEXT)
 pol_arith_OBJECTS = $(am_pol_arith_OBJECTS)
 pol_arith_LDADD = $(LDADD)
-pol_arith_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pol_arith_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_pol_eval_OBJECTS = pol_eval.$(OBJEXT)
 pol_eval_OBJECTS = $(am_pol_eval_OBJECTS)
 pol_eval_LDADD = $(LDADD)
-pol_eval_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pol_eval_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_pol_factor_OBJECTS = pol_factor.$(OBJEXT)
 pol_factor_OBJECTS = $(am_pol_factor_OBJECTS)
 pol_factor_LDADD = $(LDADD)
-pol_factor_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pol_factor_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_trunc_arith_OBJECTS = trunc_arith.$(OBJEXT)
 trunc_arith_OBJECTS = $(am_trunc_arith_OBJECTS)
 trunc_arith_LDADD = $(LDADD)
-trunc_arith_DEPENDENCIES = $(am__DEPENDENCIES_1)
+trunc_arith_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -113,6 +133,11 @@ DIST_SOURCES = $(PolynomialCRT_SOURCES) $(highorder_SOURCES) \
 	$(isprimitive_SOURCES) $(pol_arith_SOURCES) \
 	$(pol_eval_SOURCES) $(pol_factor_SOURCES) \
 	$(trunc_arith_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -145,6 +170,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -180,6 +206,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -266,7 +293,7 @@ AM_CPPFLAGS = -I$(top_srcdir) $(OPTFLAGS) $(GMP_CFLAGS) \
 # icc for itanium2
 #OPTFLAGS+= -tpp2 -mcpu=itanium2
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS = -static
 CLEANFILES = $(EXTRA_PROGRAMS)
 interpolate_SOURCES = interpolate.C
@@ -294,9 +321,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps examples/Polynomial/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps examples/Polynomial/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps examples/Polynomial/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps examples/Polynomial/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -314,31 +341,32 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-PolynomialCRT$(EXEEXT): $(PolynomialCRT_OBJECTS) $(PolynomialCRT_DEPENDENCIES) 
+$(am__aclocal_m4_deps):
+PolynomialCRT$(EXEEXT): $(PolynomialCRT_OBJECTS) $(PolynomialCRT_DEPENDENCIES) $(EXTRA_PolynomialCRT_DEPENDENCIES) 
 	@rm -f PolynomialCRT$(EXEEXT)
 	$(CXXLINK) $(PolynomialCRT_OBJECTS) $(PolynomialCRT_LDADD) $(LIBS)
-highorder$(EXEEXT): $(highorder_OBJECTS) $(highorder_DEPENDENCIES) 
+highorder$(EXEEXT): $(highorder_OBJECTS) $(highorder_DEPENDENCIES) $(EXTRA_highorder_DEPENDENCIES) 
 	@rm -f highorder$(EXEEXT)
 	$(CXXLINK) $(highorder_OBJECTS) $(highorder_LDADD) $(LIBS)
-interpolate$(EXEEXT): $(interpolate_OBJECTS) $(interpolate_DEPENDENCIES) 
+interpolate$(EXEEXT): $(interpolate_OBJECTS) $(interpolate_DEPENDENCIES) $(EXTRA_interpolate_DEPENDENCIES) 
 	@rm -f interpolate$(EXEEXT)
 	$(CXXLINK) $(interpolate_OBJECTS) $(interpolate_LDADD) $(LIBS)
-isirred$(EXEEXT): $(isirred_OBJECTS) $(isirred_DEPENDENCIES) 
+isirred$(EXEEXT): $(isirred_OBJECTS) $(isirred_DEPENDENCIES) $(EXTRA_isirred_DEPENDENCIES) 
 	@rm -f isirred$(EXEEXT)
 	$(CXXLINK) $(isirred_OBJECTS) $(isirred_LDADD) $(LIBS)
-isprimitive$(EXEEXT): $(isprimitive_OBJECTS) $(isprimitive_DEPENDENCIES) 
+isprimitive$(EXEEXT): $(isprimitive_OBJECTS) $(isprimitive_DEPENDENCIES) $(EXTRA_isprimitive_DEPENDENCIES) 
 	@rm -f isprimitive$(EXEEXT)
 	$(CXXLINK) $(isprimitive_OBJECTS) $(isprimitive_LDADD) $(LIBS)
-pol_arith$(EXEEXT): $(pol_arith_OBJECTS) $(pol_arith_DEPENDENCIES) 
+pol_arith$(EXEEXT): $(pol_arith_OBJECTS) $(pol_arith_DEPENDENCIES) $(EXTRA_pol_arith_DEPENDENCIES) 
 	@rm -f pol_arith$(EXEEXT)
 	$(CXXLINK) $(pol_arith_OBJECTS) $(pol_arith_LDADD) $(LIBS)
-pol_eval$(EXEEXT): $(pol_eval_OBJECTS) $(pol_eval_DEPENDENCIES) 
+pol_eval$(EXEEXT): $(pol_eval_OBJECTS) $(pol_eval_DEPENDENCIES) $(EXTRA_pol_eval_DEPENDENCIES) 
 	@rm -f pol_eval$(EXEEXT)
 	$(CXXLINK) $(pol_eval_OBJECTS) $(pol_eval_LDADD) $(LIBS)
-pol_factor$(EXEEXT): $(pol_factor_OBJECTS) $(pol_factor_DEPENDENCIES) 
+pol_factor$(EXEEXT): $(pol_factor_OBJECTS) $(pol_factor_DEPENDENCIES) $(EXTRA_pol_factor_DEPENDENCIES) 
 	@rm -f pol_factor$(EXEEXT)
 	$(CXXLINK) $(pol_factor_OBJECTS) $(pol_factor_LDADD) $(LIBS)
-trunc_arith$(EXEEXT): $(trunc_arith_OBJECTS) $(trunc_arith_DEPENDENCIES) 
+trunc_arith$(EXEEXT): $(trunc_arith_OBJECTS) $(trunc_arith_DEPENDENCIES) $(EXTRA_trunc_arith_DEPENDENCIES) 
 	@rm -f trunc_arith$(EXEEXT)
 	$(CXXLINK) $(trunc_arith_OBJECTS) $(trunc_arith_LDADD) $(LIBS)
 
@@ -375,7 +403,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -383,29 +411,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -426,13 +459,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -450,10 +487,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -461,6 +503,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -556,7 +599,8 @@ uninstall-am:
 # see the COPYRIGHT file for more details.
 all: $(EXTRA_PROGRAMS)
 %:%.C
-	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs`
+	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)    `$(GIVARO_BIN)/givaro-config --libs`
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/examples/Polynomial/PolynomialCRT.C b/examples/Polynomial/PolynomialCRT.C
index 27f4794..603e94a 100644
--- a/examples/Polynomial/PolynomialCRT.C
+++ b/examples/Polynomial/PolynomialCRT.C
@@ -55,7 +55,7 @@ bool tmain(int argc, char ** argv, GivRandom& generator) {
     Integer a( generator() >>(argc>2?atoi(argv[2]):17) );
     Field F(ID.nextprimein( a ));
 
-    VScal Primes( argc>1 ? atoi(argv[1]):15);
+    VScal Primes( argc>1 ? (size_t)atoi(argv[1]):15);
     VScal Moduli( Primes.size() );
 
     typename VScal::iterator i = Primes.begin();
@@ -105,7 +105,7 @@ bool tmain(int argc, char ** argv, GivRandom& generator) {
             break;
         }
 
-    CRT.getpolydom().random(generator, res, Degree(Primes.size()-1));
+    CRT.getpolydom().random(generator, res, Degree((long)Primes.size()-1));
     CRT.RingToRns( Verifs, res );
     Poly nres;
 
@@ -136,7 +136,7 @@ bool tmainext(int argc, char ** argv, GivRandom& generator) {
     Integer a( generator() >>(argc>2?atoi(argv[2]):17) );
     Field F(ID.nextprimein( a ),2);
 
-    VScal Primes( argc>1 ? atoi(argv[1]):15);
+    VScal Primes( argc>1 ? (size_t)atoi(argv[1]):15);
     VScal Moduli( Primes.size() );
 
     typename VScal::iterator i = Primes.begin();
@@ -187,7 +187,7 @@ F.write(std::cout, *it) << std::endl;
             break;
         }
 
-    CRT.getpolydom().random(generator, res, Degree(Primes.size()-1));
+    CRT.getpolydom().random(generator, res, Degree((long)Primes.size()-1));
     CRT.RingToRns( Verifs, res );
     Poly nres;
 
@@ -213,7 +213,7 @@ int main(int argc, char ** argv) {
         // argv[2] : 2^{32-j} is size of primes
         // argv[3] : seed for generator
 
-    GivRandom seedor( argc>3 ? atoi(argv[3]): BaseTimer::seed() );
+    GivRandom seedor( argc>3 ? (unsigned long)atoi(argv[3]): (unsigned long)BaseTimer::seed() );
     unsigned long seed = seedor.seed();
     std::cerr << "seed: " << seed << std::endl;
 
diff --git a/examples/Polynomial/highorder.C b/examples/Polynomial/highorder.C
index 7de7372..ee8362d 100644
--- a/examples/Polynomial/highorder.C
+++ b/examples/Polynomial/highorder.C
@@ -163,10 +163,10 @@ int main(int argc, char ** argv) {
     Polys DP101( Z101, Indeter("X") );
     Polys::Element P, Q, R, monomial;
 
-    GivRandom generator(seed);
-    long deg1 = generator() % 6;
-    long deg2 = generator() % 6;
-    long deg3 = generator() % 155;
+    GivRandom generator((unsigned long)seed);
+    long deg1 = (long) generator() % 6;
+    long deg2 = (long) generator() % 6;
+    long deg3 = (long) generator() % 155;
 	// long v1 = generator() % 195;
 	// long v2 = v1 +  (generator() % 5);
     DP101.random(generator, P, Degree(deg1) );
@@ -195,7 +195,7 @@ int main(int argc, char ** argv) {
     size_t e = 0 ; // initialisé à quoi ? dans GammaId, k0 est const...
 
     HighOrders::Truncated G0;
-    HO101.GammaId(G0, S, dS, e, P, dP);
+    HO101.GammaId(G0, S, dS, (long)e, P, dP);
     std::cout << "e:=" << e << ';' << std::endl;
     HO101.write(std::cout << "G0:=", G0) << ';' << std::endl;
     DP101.write(std::cout << "S:=", S) << ';' << std::endl;
@@ -232,10 +232,10 @@ int main(int argc, char ** argv) {
 
 
     for(long i=0; i<numb; ++i) {
-        long Deg1 = generator() % ((66*tttn)/100);
-        long Deg2 = generator() % ((65*tttn)/100);
-        long v1 = generator() % ((19195*tttn)/100);
-        long v2 = v1 + (generator() % ((45*tttn)/100));
+        long Deg1 = (long)generator() % ((66*tttn)/100);
+        long Deg2 = (long)generator() % ((65*tttn)/100);
+        long v1 = (long)generator() % ((19195*tttn)/100);
+        long v2 = v1 + ((long)generator() % (long)((45*tttn)/100));
         DP101.random(generator, P, Degree(Deg1) );
         DP101.random(generator, Q, Degree(Deg2) );
         success &= TestFracDevel(HO101, P, Q, v1, v2);
diff --git a/examples/Polynomial/interpolate.C b/examples/Polynomial/interpolate.C
index 0928e91..f8dd29b 100644
--- a/examples/Polynomial/interpolate.C
+++ b/examples/Polynomial/interpolate.C
@@ -27,9 +27,10 @@ using namespace Givaro;
 
 int main(int argc, char** argv)
 {
-  ZpzDom<Std32>::Residu_t MOD;
+	typedef ZpzDom<Std32>::Residu_t UT ;
+	UT MOD;
   if (argc > 2)
-	  MOD = atoi(argv[2]);
+	  MOD = (UT) atoi(argv[2]);
   else
 	  std::cin >> MOD;
 
diff --git a/examples/Polynomial/isirred.C b/examples/Polynomial/isirred.C
index 6443454..67025ee 100644
--- a/examples/Polynomial/isirred.C
+++ b/examples/Polynomial/isirred.C
@@ -25,13 +25,14 @@ using namespace Givaro;
 
 int main(int argc, char** argv)
 {
-  GFqDom<long>::Residu_t MOD;
+  typedef GFqDom<long>::Residu_t UT ;
+  UT MOD;
   if (argc > 1)
-	  MOD = atoi(argv[1]);
+	  MOD =(UT) (atoi(argv[1]));
   else
 	  std::cin >> MOD;
   unsigned long expo = 1;
-  if (argc > 2) expo = atoi(argv[2]);
+  if (argc > 2) expo = (unsigned long)atoi(argv[2]);
 
   GFqDom<long> F(MOD, expo);
 
diff --git a/examples/Polynomial/isprimitive.C b/examples/Polynomial/isprimitive.C
index be2fcb6..b02bbea 100644
--- a/examples/Polynomial/isprimitive.C
+++ b/examples/Polynomial/isprimitive.C
@@ -23,13 +23,14 @@ using namespace Givaro;
 
 int main(int argc, char** argv)
 {
-  GFqDom<long>::Residu_t MOD;
+	typedef GFqDom<long>::Residu_t UT;
+	UT MOD;
   if (argc > 1)
-	  MOD = atoi(argv[1]);
+	  MOD = (UT)atoi(argv[1]);
   else
 	  std::cin >> MOD;
   unsigned long expo = 1;
-  if (argc > 2) expo = atoi(argv[2]);
+  if (argc > 2) expo = (unsigned long)atoi(argv[2]);
 
   GFqDom<long> F(MOD, expo);
 
diff --git a/examples/Polynomial/pol_eval.C b/examples/Polynomial/pol_eval.C
index d5efe7c..6db56e7 100644
--- a/examples/Polynomial/pol_eval.C
+++ b/examples/Polynomial/pol_eval.C
@@ -26,11 +26,11 @@ int main(int argc, char** argv)
 {
   GFqDom<long>::Residu_t MOD;
   if (argc > 1)
-	  MOD = atoi(argv[1]);
+	  MOD = (GFqDom<long>::Residu_t) atoi(argv[1]);
   else
 	  std::cin >> MOD;
   unsigned long expo = 1;
-  if (argc > 2) expo = atoi(argv[2]);
+  if (argc > 2) expo = (unsigned long)atoi(argv[2]);
 
   GFqDom<long> F(MOD, expo);
 
diff --git a/examples/Polynomial/pol_factor.C b/examples/Polynomial/pol_factor.C
index 49ddc35..bb5f7c5 100644
--- a/examples/Polynomial/pol_factor.C
+++ b/examples/Polynomial/pol_factor.C
@@ -26,11 +26,11 @@ int main(int argc, char** argv)
 {
   GFqDom<long>::Residu_t MOD;
   if (argc > 1)
-	  MOD = atoi(argv[1]);
+	  MOD = (GFqDom<long>::Residu_t) atoi(argv[1]);
   else
 	  std::cin >> MOD;
   unsigned long expo = 1;
-  if (argc > 2) expo = atoi(argv[2]);
+  if (argc > 2) expo = (unsigned long)atoi(argv[2]);
 
   GFqDom<long> F(MOD, expo);
 
diff --git a/examples/Polynomial/trunc_arith.C b/examples/Polynomial/trunc_arith.C
index 9d38d49..8cdb72f 100644
--- a/examples/Polynomial/trunc_arith.C
+++ b/examples/Polynomial/trunc_arith.C
@@ -27,14 +27,14 @@ bool TestAdd(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.add ( R, P, Q, d1, d2); // R = P*Q;
+    DP.add ( R, P, Q, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.add (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR ADD:" << TTcount << std::endl;
@@ -55,14 +55,14 @@ bool TestSub(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.sub ( R, P, Q, d1, d2); // R = P*Q;
+    DP.sub ( R, P, Q, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.sub (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR SUB:" << TTcount << std::endl;
@@ -83,14 +83,14 @@ bool TestMul(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.mul ( R, P, Q, d1, d2); // R = P*Q;
+    DP.mul ( R, P, Q, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.mul (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR MUL:" << TTcount << std::endl;
@@ -111,14 +111,14 @@ bool TestAxpy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.axpy ( R, P, Q, G, d1, d2); // R = P*Q;
+    DP.axpy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.axpy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR Axpy:" << std::endl;
@@ -144,14 +144,14 @@ bool TestAxmy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.axmy ( R, P, Q, G, d1, d2); // R = P*Q;
+    DP.axmy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.axmy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR Axmy:" << std::endl;
@@ -172,14 +172,14 @@ bool TestMaxpy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >:
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V;
-    DP.maxpy ( R, P, Q, G, d1, d2); // R = P*Q;
+    DP.maxpy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.maxpy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) ) {
         std::cerr << "ERROR Maxpy:" << std::endl;
diff --git a/examples/Rational/Makefile.am b/examples/Rational/Makefile.am
index 545aec3..2152358 100755
--- a/examples/Rational/Makefile.am
+++ b/examples/Rational/Makefile.am
@@ -27,7 +27,7 @@ AM_CXXFLAGS = @DEFAULT_CFLAGS@
 AM_CPPFLAGS += $(OPTFLAGS) $(GMP_CFLAGS)
 AM_CPPFLAGS += -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/bstruct -I$(top_srcdir)/src/kernel/rational -I$(top_srcdir)/src/library/tools -I$(top_srcdir)/src/library/poly1
 
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS=-static
 
 
diff --git a/examples/Rational/Makefile.in b/examples/Rational/Makefile.in
index d424496..440b2c1 100644
--- a/examples/Rational/Makefile.in
+++ b/examples/Rational/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,9 +15,27 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -51,15 +69,16 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am_iratrecon_OBJECTS = iratrecon.$(OBJEXT)
 iratrecon_OBJECTS = $(am_iratrecon_OBJECTS)
 iratrecon_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
-iratrecon_DEPENDENCIES = $(am__DEPENDENCIES_1)
+iratrecon_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_polydouble_OBJECTS = polydouble.$(OBJEXT)
 polydouble_OBJECTS = $(am_polydouble_OBJECTS)
 polydouble_LDADD = $(LDADD)
-polydouble_DEPENDENCIES = $(am__DEPENDENCIES_1)
+polydouble_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -74,6 +93,11 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(iratrecon_SOURCES) $(polydouble_SOURCES)
 DIST_SOURCES = $(iratrecon_SOURCES) $(polydouble_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -106,6 +130,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -141,6 +166,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -227,7 +253,7 @@ AM_CPPFLAGS = -I$(top_srcdir) $(OPTFLAGS) $(GMP_CFLAGS) \
 # icc for itanium2
 #OPTFLAGS+= -tpp2 -mcpu=itanium2
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
-LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
+LDADD = -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS) $(LDFLAGS)
 AM_LDFLAGS = -static
 CLEANFILES = $(EXTRA_PROGRAMS)
 iratrecon_SOURCES = iratrecon.C
@@ -248,9 +274,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps examples/Rational/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps examples/Rational/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps examples/Rational/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps examples/Rational/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -268,10 +294,11 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-iratrecon$(EXEEXT): $(iratrecon_OBJECTS) $(iratrecon_DEPENDENCIES) 
+$(am__aclocal_m4_deps):
+iratrecon$(EXEEXT): $(iratrecon_OBJECTS) $(iratrecon_DEPENDENCIES) $(EXTRA_iratrecon_DEPENDENCIES) 
 	@rm -f iratrecon$(EXEEXT)
 	$(CXXLINK) $(iratrecon_OBJECTS) $(iratrecon_LDADD) $(LIBS)
-polydouble$(EXEEXT): $(polydouble_OBJECTS) $(polydouble_DEPENDENCIES) 
+polydouble$(EXEEXT): $(polydouble_OBJECTS) $(polydouble_DEPENDENCIES) $(EXTRA_polydouble_DEPENDENCIES) 
 	@rm -f polydouble$(EXEEXT)
 	$(CXXLINK) $(polydouble_OBJECTS) $(polydouble_LDADD) $(LIBS)
 
@@ -308,7 +335,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -316,29 +343,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -359,13 +391,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -383,10 +419,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -394,6 +435,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -490,6 +532,7 @@ uninstall-am:
 all: $(EXTRA_PROGRAMS)
 %:%.C
 	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs`
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/examples/Rational/polydouble.C b/examples/Rational/polydouble.C
index 71bf3d3..e5089bb 100644
--- a/examples/Rational/polydouble.C
+++ b/examples/Rational/polydouble.C
@@ -22,15 +22,6 @@ using namespace Givaro;
 typedef Poly1Dom< RationalDom, Dense>::Element RatPoly;
 typedef std::vector<double> DoublePoly;
 
-std::ostream& operator<< (std::ostream& o, const RatPoly& v) {
-    o << "Poly (s [v_1, ..,  v_s]) : ";
-    o << v.size() << " [";
-    for(size_t i=0; i<v.size(); ++i) {
-        o << ' ' << v[i];
-    }
-    return o << ']';
-}
-
 std::ostream& operator<< (std::ostream& o, const DoublePoly& v) {
     o << '[';
     for(size_t i=0; i<v.size(); ++i) {
@@ -54,7 +45,7 @@ int main(int argc, char** argv)
     RatPoly R;
 
 
-    size_t n = (argc>1?atoi(argv[1]):10);
+    size_t n = (argc>1?(size_t)atoi(argv[1]):10);
 
     for(size_t i=0;i<n;++i)
         D.push_back( (double(random()) / RAND_MAX) );
diff --git a/givaro-config.h b/givaro-config.h
index e5c7d56..1079ea2 100644
--- a/givaro-config.h
+++ b/givaro-config.h
@@ -131,24 +131,27 @@
 /* Define to 1 if the system has the type `_Bool'. */
 /* #undef __GIVARO_HAVE__BOOL */
 
+/* Define if you want most code inlined */
+/* #undef __GIVARO_INLINE_ALL */
+
 /* Canonical 16-bit data type */
 #ifndef __GIVARO_INT16 
-#define __GIVARO_INT16  short 
+#define __GIVARO_INT16   
 #endif
 
 /* Canonical 32-bit data type */
 #ifndef __GIVARO_INT32 
-#define __GIVARO_INT32  int 
+#define __GIVARO_INT32   
 #endif
 
 /* Canonical 64-bit data type */
 #ifndef __GIVARO_INT64 
-#define __GIVARO_INT64  long 
+#define __GIVARO_INT64   
 #endif
 
 /* Canonical 8-bit data type */
 #ifndef __GIVARO_INT8 
-#define __GIVARO_INT8  char 
+#define __GIVARO_INT8   
 #endif
 
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
@@ -174,7 +177,7 @@
 
 /* Define to the full name and version of this package. */
 #ifndef __GIVARO_PACKAGE_STRING 
-#define __GIVARO_PACKAGE_STRING  "Givaro 3.4.2" 
+#define __GIVARO_PACKAGE_STRING  "Givaro 3.7.0" 
 #endif
 
 /* Define to the one symbol short name of this package. */
@@ -189,7 +192,7 @@
 
 /* Define to the version of this package. */
 #ifndef __GIVARO_PACKAGE_VERSION 
-#define __GIVARO_PACKAGE_VERSION  "3.4.2" 
+#define __GIVARO_PACKAGE_VERSION  "3.7.0" 
 #endif
 
 /* The size of `char', as computed by sizeof. */
@@ -234,7 +237,7 @@
 
 /* Version number of package */
 #ifndef __GIVARO_VERSION 
-#define __GIVARO_VERSION  "3.4.2" 
+#define __GIVARO_VERSION  "3.7.0" 
 #endif
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
diff --git a/givaro-config.in b/givaro-config.in
index b6fd444..48084d5 100644
--- a/givaro-config.in
+++ b/givaro-config.in
@@ -11,6 +11,18 @@ exec_prefix=@exec_prefix@
 includedir=@includedir@
 libdir=@libdir@
 
+
+major=`echo @VERSION@ | cut -d'.' -f1`
+minor=`echo @VERSION@ | cut -d'.' -f2`
+micro=`echo @VERSION@ | cut -d'.' -f3`
+decvr=$((((($major*100)+$minor)*100)+$micro))
+
+
+
+cflags=false
+libs=false
+
+
 usage()
 {
     cat <<EOF
@@ -22,7 +34,8 @@ Known values for OPTION are:
   --libs		print library linking information
   --cflags		print pre-processor and compiler flags
   --help		display this help and exit
-  --version		output version information
+  --version		output version information string (that is @VERSION@)
+  --decimal-version     output version information number (that is $decvr, also available in givconfig.h)
 
 EOF
 
@@ -33,8 +46,6 @@ if test $# -eq 0; then
     usage 1
 fi
 
-cflags=false
-libs=false
 
 while test $# -gt 0; do
     case "$1" in
@@ -56,6 +67,11 @@ while test $# -gt 0; do
 	exit 0
 	;;
 
+    --decimal-version)
+	echo $decvr
+	exit 0
+	;;
+
     --help)
 	usage 0
 	;;
@@ -65,7 +81,7 @@ while test $# -gt 0; do
 	;;
 
     --libs)
-       	echo -L${libdir} ${libdir}/libgivaro.so -lgivaro @GMP_LIBS@ 
+       	echo -L${libdir} -lgivaro @GMP_LIBS@ 
        	;;
 
     *)
diff --git a/build-aux/install-sh b/install-sh
similarity index 95%
copy from build-aux/install-sh
copy to install-sh
index 6781b98..a9244eb 100755
--- a/build-aux/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for `test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -200,7 +208,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for `test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/build-aux/ltmain.sh b/ltmain.sh
similarity index 99%
copy from build-aux/ltmain.sh
copy to ltmain.sh
index 6f650ae..3061e3c 100755
--- a/build-aux/ltmain.sh
+++ b/ltmain.sh
@@ -69,7 +69,7 @@
 #         compiler:		$LTCC
 #         compiler flags:		$LTCFLAGS
 #         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4 Debian-2.4-2
+#         $progname:	(GNU libtool) 2.4
 #         automake:	$automake_version
 #         autoconf:	$autoconf_version
 #
@@ -79,7 +79,7 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4 Debian-2.4-2"
+VERSION=2.4
 TIMESTAMP=""
 package_revision=1.3293
 
@@ -136,15 +136,15 @@ progpath="$0"
 
 : ${CP="cp -f"}
 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${EGREP="/bin/grep -E"}
-: ${FGREP="/bin/grep -F"}
-: ${GREP="/bin/grep"}
+: ${EGREP="grep -E"}
+: ${FGREP="grep -F"}
+: ${GREP="grep"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/bin/sed"}
+: ${SED="sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -6111,10 +6111,7 @@ func_mode_link ()
 	case $pass in
 	dlopen) libs="$dlfiles" ;;
 	dlpreopen) libs="$dlprefiles" ;;
-	link)
-	  libs="$deplibs %DEPLIBS%"
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-	  ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 	esac
       fi
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
@@ -6433,19 +6430,19 @@ func_mode_link ()
 	    # It is a libtool convenience library, so add in its objects.
 	    func_append convenience " $ladir/$objdir/$old_library"
 	    func_append old_convenience " $ladir/$objdir/$old_library"
-	    tmp_libs=
-	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-	      if $opt_preserve_dup_deps ; then
-		case "$tmp_libs " in
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
-		esac
-	      fi
-	      func_append tmp_libs " $deplib"
-	    done
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done
 	  continue
 	fi # $pass = conv
 
@@ -7337,9 +7334,6 @@ func_mode_link ()
 	    revision="$number_minor"
 	    lt_irix_increment=no
 	    ;;
-	  *)
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
-	    ;;
 	  esac
 	  ;;
 	no)
diff --git a/macros/Makefile.am b/macros/Makefile.am
index caebd4c..2622706 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -8,5 +8,5 @@ EXTRA_DIST=             \
 	aclocal-include.m4	\
 	gmp-check.m4		\
 	config-header.m4    \
-	givaro-doc.m4
-
+	givaro-doc.m4       \
+	debug.m4
diff --git a/macros/Makefile.in b/macros/Makefile.in
index 3cfe409..e297dcc 100644
--- a/macros/Makefile.in
+++ b/macros/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,9 +21,27 @@
 # and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -56,10 +74,16 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -90,6 +114,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -125,6 +150,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -189,7 +215,8 @@ EXTRA_DIST = \
 	aclocal-include.m4	\
 	gmp-check.m4		\
 	config-header.m4    \
-	givaro-doc.m4
+	givaro-doc.m4       \
+	debug.m4
 
 all: all-am
 
@@ -203,9 +230,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps macros/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps macros/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps macros/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps macros/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -223,6 +250,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -252,13 +280,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -276,16 +308,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -369,6 +407,7 @@ uninstall-am:
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/macros/config-header.m4 b/macros/config-header.m4
index ec1fddf..1ade032 100644
--- a/macros/config-header.m4
+++ b/macros/config-header.m4
@@ -1,10 +1,10 @@
 # Copyright(c)'1994-2009 by The Givaro group
 # This file is part of Givaro.
 # Givaro is governed by the CeCILL-B license under French law
-# and abiding by the rules of distribution of free software. 
+# and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 
-AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
+AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADERS])
 AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
 AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
 AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
diff --git a/macros/debug.m4 b/macros/debug.m4
index 2141058..072874c 100644
--- a/macros/debug.m4
+++ b/macros/debug.m4
@@ -19,73 +19,124 @@ AC_DEFUN([AC_DEBUG],
 ]
 )
 
-dnl enable as much debug flag options as possible
-dnl  AC_DEFUN([AC_FULL_DEBUG],
-dnl  [AC_MSG_CHECKING([whether to enable full debugging mode in the library])
-  dnl  AC_ARG_ENABLE(full-debug,
-dnl  [  --enable-full-debug  enable full debugging options in library],
-	  dnl  USE_FULL_DEBUG=$enableval,
-	  dnl  USE_FULL_DEBUG=no)
-  dnl  AC_MSG_RESULT([$USE_FULL_DEBUG])
-  dnl  AM_CONDITIONAL(FULL_DEBUG, [test $USE_FULL_DEBUG = yes])
-  dnl  FULLDBG=$USE_FULL_DEBUG
-  dnl  AC_SUBST(FULLDBG)dnl
-dnl  ]
-dnl  )
-
+AC_DEFUN([AC_PROFILE],
+[AC_MSG_CHECKING([whether to enable profiling everything in the library])
+  AC_ARG_ENABLE(profile,
+[AC_HELP_STRING([--enable-profile], [enable profiling options in library])],
+      USE_PROFILE=$enableval,
+      USE_PROFILE=no)
+  AC_MSG_RESULT([$USE_PROFILE])
+  AM_CONDITIONAL(PROFILE, [test $USE_PROFILE = yes])
+  PROF=$USE_PROFILE
+  AC_SUBST(PROF)dnl
+]
+)
 
 dnl Enable warnings from compiler.
 AC_DEFUN([AC_WARNINGS],
 [AC_MSG_CHECKING([whether to enable warnings when compiling the library])
   AC_ARG_ENABLE(warnings,
-[AC_HELP_STRING([--enable-warnings],[enable warings when compiling the library])],
+[AC_HELP_STRING([--enable-warnings=yes|full|no],  [enable warnings when compiling the library.
+If nothing or yes is given, more aggressive compiler warnings are passed to the compiler.
+If full is given, we become paranoïd about warnings and treat them as errors.])],
       USE_WARNINGS=$enableval,
       USE_WARNINGS=no)
   AC_MSG_RESULT([$USE_WARNINGS])
-  AM_CONDITIONAL(WARNINGS, [test $USE_WARNINGS = yes])
+  dnl  AM_CONDITIONAL(WARNINGS, [test $USE_WARNINGS = yes])
   WARN=$USE_WARNINGS
   AC_SUBST(WARN)dnl
-]
-)
+]dnl
+)dnl
+
+CCNAM=""
 
-AC_DEFUN([AC_COMPILER_NAME],
-[
-AC_MSG_CHECKING(for family name of compiler)
-AC_TRY_RUN(dnl ICC ?
-[   #ifdef __INTEL_COMPILER
+AC_DEFUN([AC_COMPILER_NAME], [
+		AC_MSG_CHECKING(for family name of compiler)
+
+		dnl CHECKING for various compilers
+		dnl ICC ?
+		AC_TRY_RUN( [
+           #ifdef __INTEL_COMPILER
    int main() { return 0 ; }
    #else
    pas intel
-   #endif],dnl
-[dnl
-   AC_MSG_RESULT(icc)
+		   #endif],
+		[ AC_MSG_RESULT(icc)
    CCNAM=icc
    AC_SUBST(CCNAM)
-],dnl GCC ?
-[dnl
-   AC_TRY_RUN(dnl GCC ?
-[#ifdef __GNUC__
-   int main() { return 0 ; }
+		])
+
+dnl PATHSCALE ?
+		AS_IF([ test -z "${CCNAM}"], [
+			AC_TRY_RUN( [
+				#ifdef __PATHSCALE__
+				   int main() { return !(__PATHCC__ >= 4) ; }
+			   #else
+				   pas ekopath non plus.
+				#endif], [
+		AC_MSG_RESULT(eko)
+		CCNAM=eko
+		AC_SUBST(CCNAM) ])
+		])
+
+dnl CLANG ?
+		AS_IF([ test -z "${CCNAM}"], [
+			AC_TRY_RUN( [
+				#ifdef __clang__
+				   int main() { return !(__clang_major >=3) ; }
+			   #else
+				   pas clang non plus.
+				#endif], [
+		AC_MSG_RESULT(clang)
+		CCNAM=clang
+		AC_SUBST(CCNAM) ])
+		])
+
+dnl GCC ?
+		AS_IF([ test -z "${CCNAM}"], [
+			AC_TRY_RUN( [
+				#ifdef __GNUC__
+				   int main() { return !(__GNUC__ >= 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) ; }
    #else
-   pas gcc non plus.
-   #endif],[
-   AC_MSG_RESULT(gcc)
+				   pas gcc non plus ???
+				#endif], [
+		CCNOM=gcc
+		AS_IF([ test -n "${CC}" ], [CCNOM="`$CC --version 2>&1|  awk 'NR<2{print $1}'`"])
    CCNAM=gcc
    AC_SUBST(CCNAM)
-   ],[
-   AC_MSG_RESULT(unknown)
-   CCNAM=unknown
-   AC_SUBST(CCNAM)
-   ],[
-   AC_MSG_RESULT(unknown)
-   CCNAM=unknown
-   AC_SUBST(CCNAM)
+		AC_MSG_RESULT($CCNOM)
    ])
-],dnl GCC !
-[
-   AC_MSG_RESULT(unknown)
+		])
+
+		dnl  autre ?
+
+		AS_IF([ test -z "${CCNAM}"],
+				[ AC_MSG_RESULT(unknown)
    CCNAM=unknown
    AC_SUBST(CCNAM)
+				echo
+				echo " *** unknow compiler. please file a bug "
+				echo
+				])
 ])
-])
+
+dnl compile library or make it mostly inlined headers ?
+
+AC_DEFUN([AC_INLINE],
+[AC_MSG_CHECKING([whether to inline or not most of the code ?])
+  AC_ARG_ENABLE(inline,
+[AC_HELP_STRING([--enable-inline],  [enable inlining most of the code])],
+      USE_INLINE=$enableval
+      AC_DEFINE(INLINE_ALL,1,[Define if you want most code inlined]) ,
+      USE_INLINE=no)
+  AC_MSG_RESULT([$USE_INLINE])
+  AM_CONDITIONAL(GIVARO_INLINE_ALL, [test $USE_INLINE = yes])
+  AC_SUBST(GIVARO_INLINE_ALL)
+  echo $GIVARO_INLINE_ALL
+  dnl  DBG=$USE_DEBUG
+  dnl  AC_SUBST(DBG)dnl
+]
+)
+
+
 
diff --git a/macros/givaro-doc.m4 b/macros/givaro-doc.m4
index 512f725..094d99c 100644
--- a/macros/givaro-doc.m4
+++ b/macros/givaro-doc.m4
@@ -1,3 +1,14 @@
+# Copyright(c)'2011 by The Givaro group
+# Written by BB <bboyer at imag.fr>
+# This file is part of Givaro.
+# Givaro is governed by the CeCILL-B license under French law
+# and abiding by the rules of distribution of free software.
+# see the COPYRIGHT file for more details.
+
+
+
+
+
 
 AC_DEFUN([GIV_DOC],
 [
@@ -25,7 +36,7 @@ AC_ARG_WITH(doxygen,
 		DOXYGEN_PATH="$PATH"
 	    ])
 
-AC_ARG_ENABLE(docs,[AC_HELP_STRING([--enable-doc], [Enable building documentation])],
+AC_ARG_ENABLE(doc,[AC_HELP_STRING([--enable-doc], [Enable building documentation])],
 [
 AC_MSG_RESULT(yes)
 AC_MSG_CHECKING(whether doxygen works)
@@ -39,11 +50,32 @@ export PATH=$DOXYGEN_PATH
 	echo "the source tarball from http://www.stack.nl/~dimitri/doxygen/"
 	exit -1
 }
+AM_CONDITIONAL(GIVARO_DOXYGEN_FOUND,     true)
 AC_MSG_RESULT(yes)
 AM_CONDITIONAL(GIVARO_BUILD_DOC, true)
+
 ],
 [
+AS_IF([(doxygen --version) < /dev/null > /dev/null 2>&1],
+[AM_CONDITIONAL(GIVARO_DOXYGEN_FOUND,  true)],
+[AM_CONDITIONAL(GIVARO_DOXYGEN_FOUND, false)]
+)
 AC_MSG_RESULT(no)
 AM_CONDITIONAL(GIVARO_BUILD_DOC, false)
 ])
+
+AC_MSG_CHECKING(whether dot works)
+res=yes;
+(dot -V) < /dev/null > /dev/null 2>&1 || res=no
+AC_MSG_RESULT([$res])
+AS_IF([test $res = yes],
+[
+sed 's/^HAVE_DOT.*/HAVE_DOT = YES/' docs/Doxyfile.mod > docs/Doxyfile
+sed 's/^HAVE_DOT.*/HAVE_DOT = YES/' docs/DoxyfileDev.mod > docs/DoxyfileDev
+],
+[ cp docs/Doxyfile.mod docs/Doxyfile ;
+cp docs/DoxyfileDev.mod docs/DoxyfileDev
+])
+
+
 ])
diff --git a/macros/gmp-check.m4 b/macros/gmp-check.m4
index 55ad0fd..7b5a221 100644
--- a/macros/gmp-check.m4
+++ b/macros/gmp-check.m4
@@ -35,16 +35,18 @@ dnl Check for existence
 BACKUP_CXXFLAGS=${CXXFLAGS}
 BACKUP_LIBS=${LIBS}
 
-
+GMP_PATH=
 for GMP_HOME in ${GMP_HOME_PATH}
   do
 	if test "x$GMP_HOME" != "x/usr" -a "x$GMP_HOME" != "x/usr/local"; then
 		if test -r "$GMP_HOME/include/gmp.h" ; then
 			GMP_CFLAGS="-I${GMP_HOME}/include"
+			GMP_PATH="-L${GMP_HOME}/lib"
 			GMP_LIBS="-L${GMP_HOME}/lib -lgmp"
 		else
 		   if test -r "$GMP_HOME/gmp.h" ; then
 			GMP_CFLAGS="-I${GMP_HOME}"
+			GMP_PATH="-L${GMP_HOME}"
 			GMP_LIBS="-L${GMP_HOME} -lgmp"
 		   else
 			echo "($GMP_HOME) seems an invalid GMP prefix"
@@ -62,11 +64,24 @@ for GMP_HOME in ${GMP_HOME_PATH}
 	LIBS="${LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
-	[#include <gmp.h>],
+		[
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+#include <ansi/_cstddef.h>
+#endif
+#include "stddef.h"
+		#include <gmp.h>
+		],
 	[mpz_t a; mpz_init (a);],
 	[
         	AC_TRY_RUN(
- 		[#include <gmp.h>
+ 			[
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+		#include <ansi/_cstddef.h>
+		#include "stddef.h"
+#endif
+		#include <gmp.h>
 		 int main () {  if (__GNU_MP_VERSION < 3) return -1; else return 0; }
 	  	],[
 			AC_MSG_RESULT(found)
@@ -76,7 +91,13 @@ for GMP_HOME in ${GMP_HOME_PATH}
 			# See if we are running GMP 4.0
 	   		AC_MSG_CHECKING(whether GMP is 4.0 or greater)
 	   		AC_TRY_RUN(
-	   		[#include <gmp.h>
+		   		[
+#ifdef __PATHCC__
+#include <rw/_defs.h>
+		#include <ansi/_cstddef.h>
+		#include "stddef.h"
+#endif
+#include <gmp.h>
 	    		int main () { if (__GNU_MP_VERSION < 4) return -1; else return 0; }
 	   		],[
 				AC_MSG_RESULT(yes)
@@ -88,7 +109,9 @@ for GMP_HOME in ${GMP_HOME_PATH}
 				],[
 					AC_MSG_RESULT(yes)
 					GMP_VERSION=""
+					GMP_LIBS="${GMP_PATH} -lgmpxx -lgmp"
 					AC_SUBST(GMP_VERSION)
+					AC_SUBST(GMP_LIBS)
 				],[
 					AC_MSG_RESULT(no)
 					AC_DEFINE(GMP_NO_CXX,1,[Define if GMP has no <gmpxx.h>])
diff --git a/macros/libtool.m4 b/macros/libtool.m4
index 8ff3c76..2ed159c 100644
--- a/macros/libtool.m4
+++ b/macros/libtool.m4
@@ -2421,7 +2421,14 @@ freebsd* | dragonfly*)
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -2432,6 +2439,12 @@ freebsd* | dragonfly*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -2461,7 +2474,6 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
@@ -2626,18 +2638,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -3243,7 +3243,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -4054,7 +4054,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      netbsd* | netbsdelf*-gnu)
+      netbsd*)
 	;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -4512,9 +4512,6 @@ m4_if([$1], [CXX], [
       ;;
     esac
     ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     ;;
@@ -4578,9 +4575,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4803,7 +4797,7 @@ _LT_EOF
       fi
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -4980,7 +4974,6 @@ _LT_EOF
 	if test "$aix_use_runtimelinking" = yes; then
 	  shared_flag="$shared_flag "'${wl}-G'
 	fi
-	_LT_TAGVAR(link_all_deplibs, $1)=no
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -5289,7 +5282,7 @@ _LT_EOF
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
diff --git a/build-aux/missing b/missing
similarity index 89%
copy from build-aux/missing
copy to missing
index 28055d2..86a8fc3 100755
--- a/build-aux/missing
+++ b/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-01-06.13; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -84,7 +84,6 @@ Supported PROGRAM values:
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -122,15 +121,6 @@ case $1 in
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
   *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
@@ -226,7 +216,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -256,7 +246,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -318,41 +308,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
diff --git a/src/Makefile.am b/src/Makefile.am
index 8da9237..6327ece 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,8 @@ AM_CPPFLAGS=-I$(top_srcdir)
 
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
 
+AM_LDFLAGS=$(LDFLAGS)
+
 SUBDIRS=kernel library
 
 lib_LTLIBRARIES= libgivaro.la
@@ -18,4 +20,5 @@ libgivaro_la_LIBADD= \
 	kernel/gmp++/libgmppp.la kernel/bstruct/libgivbstruct.la kernel/integer/libgivinteger.la kernel/memory/libgivmemory.la kernel/rational/libgivrational.la kernel/system/libgivsystem.la kernel/zpz/libgivzpz.la library/tools/libgivtools.la library/poly1/libgivpoly1.la
 
 # soname of libgivaro
-libgivaro_la_LDFLAGS = -version-info 2:2:2
+libgivaro_la_LDFLAGS = -version-info 5:0:5
+libgivaro_la_LDFLAGS+=$(LDFLAGS)
diff --git a/src/Makefile.in b/src/Makefile.in
index 3120c0a..fa8addd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -22,9 +22,27 @@
 # see the COPYRIGHT file for more details.
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -57,14 +75,35 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libgivaro_la_DEPENDENCIES = kernel/gmp++/libgmppp.la \
 	kernel/bstruct/libgivbstruct.la \
@@ -98,12 +137,45 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -133,6 +205,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -168,6 +241,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -230,6 +304,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I$(top_srcdir)
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
+AM_LDFLAGS = $(LDFLAGS)
 SUBDIRS = kernel library
 lib_LTLIBRARIES = libgivaro.la
 libgivaro_la_SOURCES = dummy.C
@@ -238,7 +313,7 @@ libgivaro_la_LIBADD = \
 
 
 # soname of libgivaro
-libgivaro_la_LDFLAGS = -version-info 2:2:2
+libgivaro_la_LDFLAGS = -version-info 5:0:5 $(LDFLAGS)
 all: all-recursive
 
 .SUFFIXES:
@@ -252,9 +327,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -272,23 +347,29 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
 	  if test -f $$p; then \
-	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    list2="$$list2 $$p"; \
 	  else :; fi; \
-	done
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
 
 uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -299,7 +380,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivaro.la: $(libgivaro_la_OBJECTS) $(libgivaro_la_DEPENDENCIES) 
+libgivaro.la: $(libgivaro_la_OBJECTS) $(libgivaro_la_DEPENDENCIES) $(EXTRA_libgivaro_la_DEPENDENCIES) 
 	$(libgivaro_la_LINK) -rpath $(libdir) $(libgivaro_la_OBJECTS) $(libgivaro_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -347,7 +428,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -381,16 +462,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -405,7 +486,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -417,7 +498,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -426,29 +507,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -469,29 +555,41 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -514,16 +612,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -597,8 +701,8 @@ ps-am:
 
 uninstall-am: uninstall-libLTLIBRARIES
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic \
@@ -616,6 +720,7 @@ uninstall-am: uninstall-libLTLIBRARIES
 	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
 	uninstall-libLTLIBRARIES
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/Makefile.in b/src/kernel/Makefile.in
index a4f72dc..0582cfa 100644
--- a/src/kernel/Makefile.in
+++ b/src/kernel/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,9 +21,27 @@
 # and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -56,6 +74,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
@@ -67,12 +86,45 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -102,6 +154,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -137,6 +190,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -212,9 +266,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -232,6 +286,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -263,7 +318,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -297,16 +352,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -321,7 +376,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -333,7 +388,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -342,29 +397,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -385,29 +445,41 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -427,16 +499,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -507,8 +585,8 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic clean-libtool \
@@ -524,6 +602,7 @@ uninstall-am:
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
 	uninstall uninstall-am
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/bstruct/Makefile.am b/src/kernel/bstruct/Makefile.am
index 2661686..6a125ea 100644
--- a/src/kernel/bstruct/Makefile.am
+++ b/src/kernel/bstruct/Makefile.am
@@ -24,6 +24,8 @@ pkginclude_HEADERS=     \
 	givlist0.inl		\
 	givstack.inl
 
+EXTRA_DIST = bstruct.doxy
+
 noinst_LTLIBRARIES=libgivbstruct.la
 
 libgivbstruct_la_SOURCES=givbits.C
diff --git a/src/kernel/bstruct/Makefile.in b/src/kernel/bstruct/Makefile.in
index 16a2678..05fcb13 100644
--- a/src/kernel/bstruct/Makefile.in
+++ b/src/kernel/bstruct/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivbstruct_la_LIBADD =
 am_libgivbstruct_la_OBJECTS = givbits.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivbstruct_la_SOURCES)
 DIST_SOURCES = $(libgivbstruct_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -231,6 +277,7 @@ pkginclude_HEADERS = \
 	givlist0.inl		\
 	givstack.inl
 
+EXTRA_DIST = bstruct.doxy
 noinst_LTLIBRARIES = libgivbstruct.la
 libgivbstruct_la_SOURCES = givbits.C
 all: all-am
@@ -246,9 +293,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/bstruct/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/bstruct/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/bstruct/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/bstruct/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -266,6 +313,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -275,7 +323,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivbstruct.la: $(libgivbstruct_la_OBJECTS) $(libgivbstruct_la_DEPENDENCIES) 
+libgivbstruct.la: $(libgivbstruct_la_OBJECTS) $(libgivbstruct_la_DEPENDENCIES) $(EXTRA_libgivbstruct_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivbstruct_la_OBJECTS) $(libgivbstruct_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -300,21 +348,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -328,7 +380,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -336,29 +388,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -379,13 +436,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -406,16 +467,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -505,6 +572,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/bstruct/bstruct.doxy b/src/kernel/bstruct/bstruct.doxy
new file mode 100644
index 0000000..b3bdfe1
--- /dev/null
+++ b/src/kernel/bstruct/bstruct.doxy
@@ -0,0 +1,7 @@
+/** @defgroup bstruct bstruct
+ * @ingroup givaro
+ * @brief NO DOC.
+ * NO DOC
+ */
+
+// vim:syntax=doxygen
diff --git a/src/kernel/bstruct/givarray0.h b/src/kernel/bstruct/givarray0.h
index 096414e..27150b1 100644
--- a/src/kernel/bstruct/givarray0.h
+++ b/src/kernel/bstruct/givarray0.h
@@ -8,10 +8,14 @@
 // Author: T. Gautier
 // $Id: givarray0.h,v 1.7 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
-// Description:
-// Array of type T with reference mecanism.
+//
+/*! @file givarray0.h
+ * @brief Array of type T with reference mecanism.
+ */
+
 #ifndef __GIVARO_array0_H
 #define __GIVARO_array0_H
+
 #include <stddef.h> // size_t
 
 #include "givaro/givaromm.h"
@@ -20,10 +24,28 @@
 
 namespace Givaro {
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
 GIVARO_PERF_DEFCLASS(Array0,T)
-
+#else
+//! defined by marco GIVARO_PERF_DEFCLASS. ref counting and stuff.
+template<class T>
+struct _perfArray0<T> {};
+#endif
+
+/** @class Array0
+ * NODOC
+ */
 template <class T>
-class Array0 GIVARO_PERF_INEHERIT(Array0,T) {
+class Array0
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+GIVARO_PERF_INEHERIT(Array0,T)
+#else
+: public _perfArray0<T>
+#endif
+{
+	/** @internal
+	 * build...?
+	 */
 	void build( size_t s, const T& t) ;
 public :
 	typedef int  		Indice_t;
@@ -32,88 +54,116 @@ public :
 	typedef Type_t	*Iterator_t;
 	typedef const Type_t	*constIterator_t;
 
-	// STL compliance
+	//! STL compliance
+	//@{
 	typedef Type_t value_type;
 	typedef Type_t *iterator;
 	typedef const Type_t *const_iterator;
+	//@}
 
 
-	//-- Default cstor : ctsor of s size array
+	//! Default cstor : ctsor of s size array
+	//@{
 	Array0 (size_t  s = 0);
 	Array0 (size_t  s, const T& t);
+	//@}
 
-	//-- Recopy cstor : logical copy
+	//! Recopy cstor : logical copy
 	Array0 (const Self_t& p, givNoCopy);
-	//-- Recopy cstor : physical copy
+
+	//! Recopy cstor : physical copy
 	Array0 (const Self_t& p, givWithCopy);
 
-	//-- Destructor
+	//! Destructor
 	~Array0 ();
 
-	//-- Destroy of the array
+	//! Destroy of the array
 	void destroy ();
 
-	//-- Allocation of an array of s Elements: if refcount>1
-	// then it is always a creation of new array
+	/** Allocation of an array of s Elements.
+	 * if refcount>1
+	 * then it is always a creation of new array
+	 */
 	void allocate (size_t s);
 
-	//-- Reallocation of an array of s Elements: if refcount>1
-	// then it is always a creation of new array + recopy
+	/** Reallocation of an array of s Elements.
+	 * if refcount>1
+	* then it is always a creation of new array + recopy
+	*/
 	void reallocate (size_t s);
+	//! resize
 	void resize (size_t s) { this->reallocate(s); }
+	//! reserve
 	void reserve (size_t s) { this->reallocate(s); this->reallocate(0); }
 
-	//-- Physical copy operator: reallocate dest of the same size
-	// as src (if necessary) and apply GivaroCopyItem<Array<T>,T> on each Element.
-	// This class can be specialized. Return dest (i.e, *this).
+	/** Physical copy operator.
+	 *reallocate dest of the same size
+	 * as src (if necessary) and apply GivaroCopyItem<Array<T>,T> on each Element.
+	 * This class can be specialized. Return dest (i.e, *this).
+	 */
 	Self_t& copy(const Self_t& src);
 
-	//-- Logical recopy operator: make an alias to src. Return dest.
+	//! Logical recopy operator: make an alias to src. Return dest.
 	Self_t& logcopy(const Self_t& src);
 
-	//-- assignement operator is physical copy
+	//! assignement operator is physical copy
 	Self_t& operator= (const Self_t& p);
 
-	//-- Return the occuped size of the array
+	//! Return the occuped size of the array
 	size_t size() const { return _size; }
 
-	//-- Return the physical size of the array (capacity)
+	//! Return the physical size of the array (capacity)
 	size_t phsize() const;
 
-	//-- Return the base ptr to the array
+	//! Return the base ptr to the array
+	//@{
 	Type_t* baseptr();
 	const Type_t* baseptr() const;
+	//@}
 
-	//-- Access to the ith Element:
+	//! Access to the ith Element:
+	//@{
 	const T& operator[] (Indice_t i)  const; //  { return _d[i]; }
 	T& operator[] (Indice_t i); //  { return _d[i]; } ;
+	//@}
+	//! back/front
+	//@{
 	const T& front ()  const; //  { return _d[0]; }
 	T& front (); //  { return _d[0]; } ;
+
 	const T& back ()  const; //  *(--end())
 	T& back (); //  *(--end())
+	//@}
 
-	//-- add one element at the end
+	//! add one element at the end
 	void push_back( const T& a );
 
+	//!write
 	void write(Indice_t i, const Type_t& val);
+	//! read
 	void read (Indice_t i, Type_t& val) const;
 
-
+	//! Iterators
+	//@{
 	Iterator_t begin();
 	Iterator_t end();
 	constIterator_t begin() const;
 	constIterator_t end() const;
+	//@}
 
+	//! @internal
+	//! get Counter
 	int getCounter() const
 	{
 		return *_cnt ;
 	}
 
-protected :  //--------------------- protected Internal representation
-	int* _cnt;     // reference counter on _d
-	size_t _size;  // actual size of the array. If ==0 then _psz=_d=_cnt=0
-	size_t _psz;   // physical size of the array
-	T*  _d;        // ptr to the memory
+protected :
+	//--------------------- protected Internal representation
+	int* _cnt;     //!< reference counter on _d
+	size_t _size;  //!< actual size of the array. If ==0 then _psz=_d=_cnt=0
+	size_t _psz;   //!< physical size of the array
+	T*  _d;        //!< ptr to the memory
 };
 
 } // namespace Givaro
diff --git a/src/kernel/bstruct/givarray0.inl b/src/kernel/bstruct/givarray0.inl
index c865dc1..ba991e1 100644
--- a/src/kernel/bstruct/givarray0.inl
+++ b/src/kernel/bstruct/givarray0.inl
@@ -8,17 +8,20 @@
 // Author: T. Gautier
 // $Id: givarray0.inl,v 1.7 2011-02-02 16:23:55 bboyer Exp $
 // ======================================================================= //
-// Description:
-// implementation of operators of Array0<T>
+/** @internal
+ * @file bstruct/givarray0.inl
+ * implementation of operators of Array0<T>
+ */
 
 #ifndef __GIVARO__array0_INL
 #define __GIVARO__array0_INL
 
 namespace Givaro {
 
-	// -- Default cstor : ctsor of s size array
+	// Default cstor : ctsor of s size array
 	template<class T>
-	inline void Array0<T>::build( size_t s, const T& t) {
+	inline void Array0<T>::build( size_t s, const T& t)
+	{
 		// JGD 24.02.2011 : size_t is unsigned
 		//  GIVARO_ASSERT( s>=0, "[Array<T>::cstor(size_t)] must takes a >=0 parameter");
 		_psz = _size = s;
@@ -31,23 +34,25 @@ namespace Givaro {
 	}
 
 	template<class T>
-	inline Array0<T>::Array0 ( size_t s ) {
+	inline Array0<T>::Array0 ( size_t s )
+	{
 		build(s, T());
 	}
 
 	template<class T>
-	inline Array0<T>::Array0 ( size_t s, const T& t) {
+	inline Array0<T>::Array0 ( size_t s, const T& t)
+	{
 		build(s, t);
 	}
 
 
-	//-- Recopy cstor : logical copy
+	// Recopy cstor : logical copy
 	template<class T>
-	inline Array0<T>::Array0 (const Array0<T>& p, givNoCopy)
+	inline Array0<T>::Array0 (const Self_t& p, givNoCopy)
 	{
 		_psz = p._psz; _size = p._size;
 		if (_size !=0)
-		{ // -- increment ref. counting
+		{ // increment ref. counting
 			_d = p._d;
 			_cnt = p._cnt; (*_cnt) ++;
 		}
@@ -55,9 +60,9 @@ namespace Givaro {
 	}
 
 
-	//-- Recopy cstor : physical copy
+	// Recopy cstor : physical copy
 	template<class T>
-	inline Array0<T>::Array0 (const Array0<T>& p, givWithCopy)
+	inline Array0<T>::Array0 (const Self_t& p, givWithCopy)
 	{
 		_psz = _size = p._size;
 		if (_size !=0) {
@@ -69,7 +74,7 @@ namespace Givaro {
 		} else { _d =0; _cnt =0; }
 	}
 
-	// -- Destroy of the array
+	// Destroy of the array
 	template<class T>
 	inline void Array0<T>::destroy( )
 	{
@@ -84,7 +89,7 @@ namespace Givaro {
 		_size = _psz = 0; _cnt = 0; _d = 0;
 	}
 
-	// -- Allocation of an array of s Elements
+	// Allocation of an array of s Elements
 	template<class T>
 	inline void Array0<T>::allocate( size_t s )
 	{
@@ -268,22 +273,30 @@ namespace Givaro {
 	template <class T>
 	inline typename Array0<T>::Iterator_t
 	Array0<T>::begin()
-	{ return _d; }
+	{
+		return _d;
+	}
 
 	template <class T>
 	inline typename Array0<T>::Iterator_t
 	Array0<T>::end()
-	{ return _d + _size; }
+	{
+		return _d + _size;
+	}
 
 	template <class T>
 	inline typename Array0<T>::constIterator_t
 	Array0<T>::begin() const
-	{ return _d; }
+	{
+		return _d;
+	}
 
 	template <class T>
 	inline typename Array0<T>::constIterator_t
 	Array0<T>::end() const
-	{ return _d + _size; }
+	{
+		return _d + _size;
+	}
 
 } // namespace Givaro
 
diff --git a/src/kernel/bstruct/givarrayallocator.h b/src/kernel/bstruct/givarrayallocator.h
index 6d46ac8..43cc05f 100644
--- a/src/kernel/bstruct/givarrayallocator.h
+++ b/src/kernel/bstruct/givarrayallocator.h
@@ -8,6 +8,11 @@
 // Author: T. Gautier
 // $Id: givarrayallocator.h,v 1.3 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
+
+/** @file givarrayallocator.h
+ * @ingroup bstruct
+ * @brief NO DOC
+ */
 #ifndef __GIVARO_array_allocator_H
 #define __GIVARO_array_allocator_H
 
@@ -25,8 +30,10 @@ template<class T, class Tag>
 class ArrayAllocatort { };
 
 
-// -- Specialization: for Array0Tag
+//! Array0Tag
 class Array0Tag {};
+
+//! Specialization: for Array0Tag
 template<class T, Array0Tag>
 class ArrayAllocatort : public Array0<T> {};
 
diff --git a/src/kernel/bstruct/givarrayfixed.h b/src/kernel/bstruct/givarrayfixed.h
index ef4180b..529d9f1 100644
--- a/src/kernel/bstruct/givarrayfixed.h
+++ b/src/kernel/bstruct/givarrayfixed.h
@@ -8,8 +8,11 @@
 // Author: T. Gautier
 // $Id: givarrayfixed.h,v 1.5 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
-// Description:
-// ArrayFixed of type T with fixed dimension
+/*! @file givarrayfixed.h
+ * @ingroup bstruct
+ * @brief ArrayFixed of type T with fixed dimension.
+ */
+
 #ifndef __GIVARO_array_fixed_H
 #define __GIVARO_array_fixed_H
 #include <stddef.h> // size_t
@@ -21,8 +24,15 @@
 namespace Givaro {
 
 
+	//! ArrayFixed
 template <class T, size_t SIZE>
-class ArrayFixed GIVARO_PERF_INEHERIT(ArrayFixed,T) {
+class ArrayFixed
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+GIVARO_PERF_INEHERIT(ArrayFixed,T)
+#else
+	: public _perfArrayFixed<T>
+#endif
+{
   T  _data[SIZE];        // _data
 public :
   typedef int  			Indice_t;
@@ -82,8 +92,8 @@ private:
   Self_t& operator= (const Self_t& p) {};
 };
 
-// -- Map opcode on all Elements less or requal that ith
-// -- Terminal recursion, specialization
+//! Map opcode on all Elements less or requal that ith.
+//! Terminal recursion, specialization
 template<class T, class UNARYOP, size_t ith>
 struct __giv_map_less_ith;
 
@@ -120,11 +130,13 @@ struct __giv_map_less_ith_const<T,UNARYOP,ith> {
 };
 
 
+//! Specialization
 template<class T, size_t SIZE>
 template<class UNARYOP>
 void ArrayFixed<T,SIZE>::map( UNARYOP& opcode )
 { __giv_map_less_ith<T,UNARYOP,SIZE>()(_data, opcode); }
 
+//! Specialization
 template<class T, size_t SIZE>
 template<class UNARYOP>
 void ArrayFixed<T,SIZE>::map( UNARYOP& opcode ) const
@@ -134,3 +146,4 @@ void ArrayFixed<T,SIZE>::map( UNARYOP& opcode ) const
 
 
 #endif // __GIVARO_array_fixed_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/bstruct/givbits.C b/src/kernel/bstruct/givbits.C
index c740930..a111e67 100644
--- a/src/kernel/bstruct/givbits.C
+++ b/src/kernel/bstruct/givbits.C
@@ -189,14 +189,14 @@ long Bits::numone() const
 void Bits::indexofone( Array0<base>& index) const
 {
   size_t l = rep.size();
-  index.allocate( numone() );
+  index.allocate( (size_t) numone() );
   long num =0;
   for (int i=0; i<int(l); ++i)
   {
     int quo = QUO(i);
     int rem = REM(i);
     if (((rep[quo] & Table2pow[rem]) >> rem) !=0)
-		index[int(num++)] = i;
+		index[int(num++)] = (base)i;
   }
 }
 
@@ -241,7 +241,8 @@ int Bits::get (const int i) const
 void Bits::set()
 {
   int len = (int) rep.size();
-  for (int i=0; i< len; ++i) rep[i] = ~0L;
+  for (int i=0; i< len; ++i)
+	  rep[i] = (base) ~0L;
 }
 
   // Set the i-th bit of *this
diff --git a/src/kernel/bstruct/givbits.h b/src/kernel/bstruct/givbits.h
index 40d834c..87698ba 100644
--- a/src/kernel/bstruct/givbits.h
+++ b/src/kernel/bstruct/givbits.h
@@ -8,8 +8,10 @@
 // Author: T. Gautier
 // $Id: givbits.h,v 1.3 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
-// Description:
-// - field of n bits, for any n
+/** @file givbits.h
+ * @ingroup bstruct
+ * @brief field of n bits, for any n
+ */
 #ifndef __GIVARO_bits_H
 #define __GIVARO_bits_H
 
@@ -19,6 +21,7 @@
 
 namespace Givaro {
 
+	//! Bits.
 class Bits {
 public:
   typedef size_t base ;
diff --git a/src/kernel/bstruct/givelem.h b/src/kernel/bstruct/givelem.h
index 75ccf8d..407afd1 100644
--- a/src/kernel/bstruct/givelem.h
+++ b/src/kernel/bstruct/givelem.h
@@ -8,8 +8,10 @@
 // Authors: T. Gautier
 // $Id
 // ==========================================================================
-// Description:
-// definition of a reference to an object.
+/** @file givelem.h
+ * @ingroup bstuct
+ * @brief definition of a reference to an object.
+ */
 //
 #ifndef __GIVARO_Elem_H
 #define __GIVARO_Elem_H
@@ -17,6 +19,7 @@
 namespace Givaro {
 
 
+	//! Elem Ref
 template<class T>
 struct ElemRef {
   typedef T Type_t;
@@ -27,6 +30,7 @@ struct ElemRef {
   ElemRef<T> operator= (const Type_t& v) { _ref = v; return *this; }
 };
 
+	//! Elem const Ref
 template<class T>
 struct ElemConstRef {
   typedef T Type_t;
@@ -35,6 +39,7 @@ struct ElemConstRef {
   operator const Type_t& () const { return _ref; }
 };
 
+	//!  Pair
 template<class T1, class T2>
 struct Pair {
   T1 _val1;
@@ -47,10 +52,12 @@ struct Pair {
   const T2& second() const { return _val2; }
 };
 
+//! IO
 template<class T1, class T2>
 ostream& operator<< (ostream& o, const Pair<T1,T2>& p )
 { return o << '(' << p._val1 << ',' << p._val2 << ')'; }
 
+//! IO
 template<class T1, class T2>
 istream& operator>> (istream& fin, Pair<T1,T2>& p )
 {
diff --git a/src/kernel/bstruct/givhashtable.h b/src/kernel/bstruct/givhashtable.h
index f7146c7..2a68ccc 100644
--- a/src/kernel/bstruct/givhashtable.h
+++ b/src/kernel/bstruct/givhashtable.h
@@ -8,7 +8,7 @@
 // Author: T. Gautier
 // $Id: givhashtable.h,v 1.3 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
-/*! @file bstruct/givhashtable.h
+/*! @file givhashtable.h
  * @ingroup bstruct
  * @brief hash table
  */
@@ -26,7 +26,6 @@ namespace Givaro {
  * - godel      : void -> int
  * .
  */
-
 // Generic Key for class T which can be cast to and int
 template<class T>
 class Key {
@@ -41,6 +40,7 @@ private:
   T a ;
 } ;
 
+//! Hash table
 template<class T, class Key>
 class HashTable {
 public:
diff --git a/src/kernel/bstruct/givlist0.h b/src/kernel/bstruct/givlist0.h
index 95ab727..8ce4c9c 100644
--- a/src/kernel/bstruct/givlist0.h
+++ b/src/kernel/bstruct/givlist0.h
@@ -9,7 +9,7 @@
 // $Id: givlist0.h,v 1.3 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
 
-/*! @file bstruct/givlist0.h
+/*! @file givlist0.h
  * @ingroup bstruct
  * @brief List of type T with double link and various insert/get/rmv method.
  * Used reference counting on each node of the list.
@@ -24,6 +24,7 @@
 
 namespace Givaro {
 
+	//! ListO
 template <class T>
 class List0 {
 public :
diff --git a/src/kernel/bstruct/givstack.h b/src/kernel/bstruct/givstack.h
index a8a8e1c..daf0697 100644
--- a/src/kernel/bstruct/givstack.h
+++ b/src/kernel/bstruct/givstack.h
@@ -8,11 +8,16 @@
 // Author: T. Gautier
 // $Id: givstack.h,v 1.3 2011-02-02 16:23:55 bboyer Exp $
 // ==========================================================================
+/** @file givstack.h
+ * @ingroup bstruct
+ * @brief no doc.
+ */
 #ifndef __GIVARO_stack_H
 #define __GIVARO_stack_H
 
 namespace Givaro {
 
+	//! Stack
 template <class THING>
 class Stack {
 public :
diff --git a/src/kernel/gmp++/Makefile.am b/src/kernel/gmp++/Makefile.am
index bba4209..b462690 100644
--- a/src/kernel/gmp++/Makefile.am
+++ b/src/kernel/gmp++/Makefile.am
@@ -11,28 +11,51 @@ pkgincludesubdir=$(includedir)/gmp++
 AM_CXXFLAGS=@DEFAULT_CFLAGS@
 AM_CPPFLAGS+= -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/system
 
-pkgincludesub_HEADERS=\
-	gmp++.h		      \
-	gmp++_int.h	      \
-	gmp++_int.inl	  \
-	gmp++.C		      \
-	gmp++_int.C
 
-#lib_LTLIBRARIES=libgmpxx.la
 noinst_LTLIBRARIES=libgmppp.la
 
-#libgmpxx_la_SOURCES=
-libgmppp_la_SOURCES=    \
+pkgincludesub_HEADERS=\
+	gmp++.h       \
+	gmp++_int.h   \
+	gmp++_int_rand.inl	\
+	gmp++_rat.h   \
+	gmp++_rat.inl
+
+libgmppp_la_SOURCES= gmp++_int_lib.C
+
+COMMONFILES= \
 	gmp++_int_div.C		\
 	gmp++_int_mod.C		\
 	gmp++_int_sub.C		\
 	gmp++_int_compare.C	\
+	gmp++_rat_compare.C	\
 	gmp++_int_gcd.C		\
 	gmp++_int_io.C		\
+	gmp++_rat_io.C		\
 	gmp++_int_mul.C		\
 	gmp++_int_add.C		\
+	gmp++_rat_add.C		\
 	gmp++_int_cstor.C	\
+	gmp++_rat_cstor.C	\
 	gmp++_int_misc.C	\
+	gmp++_rat_misc.C	\
 	gmp++_int_pow.C
 
-#EXTRA_DIST= gmp++.doxy
+
+if GIVARO_INLINE_ALL
+
+pkgincludesub_HEADERS += \
+	gmp++_int.C             \
+	gmp++_rat.C             \
+	$(COMMONFILES)
+
+
+else
+
+libgmppp_la_SOURCES+=            \
+	$(COMMONFILES)
+
+endif
+
+
+EXTRA_DIST= gmp++.doxy
diff --git a/src/kernel/gmp++/Makefile.in b/src/kernel/gmp++/Makefile.in
index ef969e3..5450bfe 100644
--- a/src/kernel/gmp++/Makefile.in
+++ b/src/kernel/gmp++/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -40,8 +58,16 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+ at GIVARO_INLINE_ALL_TRUE@am__append_1 = \
+ at GIVARO_INLINE_ALL_TRUE@	gmp++_int.C             \
+ at GIVARO_INLINE_ALL_TRUE@	gmp++_rat.C             \
+ at GIVARO_INLINE_ALL_TRUE@	$(COMMONFILES)
+
+ at GIVARO_INLINE_ALL_FALSE@am__append_2 = \
+ at GIVARO_INLINE_ALL_FALSE@	$(COMMONFILES)
+
 subdir = src/kernel/gmp++
-DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
+DIST_COMMON = $(am__pkgincludesub_HEADERS_DIST) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
@@ -59,12 +85,23 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgmppp_la_LIBADD =
-am_libgmppp_la_OBJECTS = gmp++_int_div.lo gmp++_int_mod.lo \
-	gmp++_int_sub.lo gmp++_int_compare.lo gmp++_int_gcd.lo \
-	gmp++_int_io.lo gmp++_int_mul.lo gmp++_int_add.lo \
-	gmp++_int_cstor.lo gmp++_int_misc.lo gmp++_int_pow.lo
+am__libgmppp_la_SOURCES_DIST = gmp++_int_lib.C gmp++_int_div.C \
+	gmp++_int_mod.C gmp++_int_sub.C gmp++_int_compare.C \
+	gmp++_rat_compare.C gmp++_int_gcd.C gmp++_int_io.C \
+	gmp++_rat_io.C gmp++_int_mul.C gmp++_int_add.C gmp++_rat_add.C \
+	gmp++_int_cstor.C gmp++_rat_cstor.C gmp++_int_misc.C \
+	gmp++_rat_misc.C gmp++_int_pow.C
+am__objects_1 = gmp++_int_div.lo gmp++_int_mod.lo gmp++_int_sub.lo \
+	gmp++_int_compare.lo gmp++_rat_compare.lo gmp++_int_gcd.lo \
+	gmp++_int_io.lo gmp++_rat_io.lo gmp++_int_mul.lo \
+	gmp++_int_add.lo gmp++_rat_add.lo gmp++_int_cstor.lo \
+	gmp++_rat_cstor.lo gmp++_int_misc.lo gmp++_rat_misc.lo \
+	gmp++_int_pow.lo
+ at GIVARO_INLINE_ALL_FALSE@am__objects_2 = $(am__objects_1)
+am_libgmppp_la_OBJECTS = gmp++_int_lib.lo $(am__objects_2)
 libgmppp_la_OBJECTS = $(am_libgmppp_la_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
@@ -79,15 +116,47 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgmppp_la_SOURCES)
-DIST_SOURCES = $(libgmppp_la_SOURCES)
+DIST_SOURCES = $(am__libgmppp_la_SOURCES_DIST)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__pkgincludesub_HEADERS_DIST = gmp++.h gmp++_int.h \
+	gmp++_int_rand.inl gmp++_rat.h gmp++_rat.inl gmp++_int.C \
+	gmp++_rat.C gmp++_int_div.C gmp++_int_mod.C gmp++_int_sub.C \
+	gmp++_int_compare.C gmp++_rat_compare.C gmp++_int_gcd.C \
+	gmp++_int_io.C gmp++_rat_io.C gmp++_int_mul.C gmp++_int_add.C \
+	gmp++_rat_add.C gmp++_int_cstor.C gmp++_rat_cstor.C \
+	gmp++_int_misc.C gmp++_rat_misc.C gmp++_int_pow.C
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludesubdir)"
-pkgincludesubHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkgincludesub_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -121,6 +190,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -156,6 +226,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -221,31 +292,29 @@ AM_CPPFLAGS = -I$(top_srcdir) ${GMP_VERSION} \
 	-I$(top_srcdir)/src/kernel/system
 pkgincludesubdir = $(includedir)/gmp++
 AM_CXXFLAGS = @DEFAULT_CFLAGS@
-pkgincludesub_HEADERS = \
-	gmp++.h		      \
-	gmp++_int.h	      \
-	gmp++_int.inl	  \
-	gmp++.C		      \
-	gmp++_int.C
-
-
-#lib_LTLIBRARIES=libgmpxx.la
 noinst_LTLIBRARIES = libgmppp.la
-
-#libgmpxx_la_SOURCES=
-libgmppp_la_SOURCES = \
+pkgincludesub_HEADERS = gmp++.h gmp++_int.h gmp++_int_rand.inl \
+	gmp++_rat.h gmp++_rat.inl $(am__append_1)
+libgmppp_la_SOURCES = gmp++_int_lib.C $(am__append_2)
+COMMONFILES = \
 	gmp++_int_div.C		\
 	gmp++_int_mod.C		\
 	gmp++_int_sub.C		\
 	gmp++_int_compare.C	\
+	gmp++_rat_compare.C	\
 	gmp++_int_gcd.C		\
 	gmp++_int_io.C		\
+	gmp++_rat_io.C		\
 	gmp++_int_mul.C		\
 	gmp++_int_add.C		\
+	gmp++_rat_add.C		\
 	gmp++_int_cstor.C	\
+	gmp++_rat_cstor.C	\
 	gmp++_int_misc.C	\
+	gmp++_rat_misc.C	\
 	gmp++_int_pow.C
 
+EXTRA_DIST = gmp++.doxy
 all: all-am
 
 .SUFFIXES:
@@ -259,9 +328,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/gmp++/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/gmp++/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/gmp++/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/gmp++/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -279,6 +348,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -288,7 +358,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgmppp.la: $(libgmppp_la_OBJECTS) $(libgmppp_la_DEPENDENCIES) 
+libgmppp.la: $(libgmppp_la_OBJECTS) $(libgmppp_la_DEPENDENCIES) $(EXTRA_libgmppp_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgmppp_la_OBJECTS) $(libgmppp_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -313,21 +383,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludesubHEADERS: $(pkgincludesub_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludesubdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludesubdir)"
-	@list='$(pkgincludesub_HEADERS)'; for p in $$list; do \
+	@list='$(pkgincludesub_HEADERS)'; test -n "$(pkgincludesubdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludesubdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludesubdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludesubHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludesubdir)/$$f'"; \
-	  $(pkgincludesubHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludesubdir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludesubdir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludesubdir)" || exit $$?; \
 	done
 
 uninstall-pkgincludesubHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkgincludesub_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludesubdir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludesubdir)/$$f"; \
-	done
+	@list='$(pkgincludesub_HEADERS)'; test -n "$(pkgincludesubdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludesubdir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -341,7 +415,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -349,29 +423,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -392,13 +471,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -419,16 +502,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -519,7 +608,6 @@ uninstall-am: uninstall-pkgincludesubHEADERS
 	tags uninstall uninstall-am uninstall-pkgincludesubHEADERS
 
 
-#EXTRA_DIST= gmp++.doxy
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/gmp++/gmp++.C b/src/kernel/gmp++/gmp++.C
deleted file mode 100644
index d73cfbc..0000000
--- a/src/kernel/gmp++/gmp++.C
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright(c)'1994-2009 by The Givaro group
-// This file is part of Givaro.
-// Givaro is governed by the CeCILL-B license under French law
-// and abiding by the rules of distribution of free software. 
-// see the COPYRIGHT file for more details.
-
-#ifndef __GMPplusplus_C__
-#define __GMPplusplus_C__
-
-#include "gmp++_int.C"
-
-#endif
diff --git a/givaro.doxy b/src/kernel/gmp++/gmp++.doxy
similarity index 73%
copy from givaro.doxy
copy to src/kernel/gmp++/gmp++.doxy
index 22cb1ef..6138dcb 100644
--- a/givaro.doxy
+++ b/src/kernel/gmp++/gmp++.doxy
@@ -4,9 +4,10 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 
-/*! @defgroup givaro Givaro
+/*! @ingroup givaro
+ * @defgroup gmp GMP
  *
- * \brief Givaro library starts here.
+ * \brief Wrapper (and more) around GMP integer interface
  *
  */
 
diff --git a/src/kernel/gmp++/gmp++.h b/src/kernel/gmp++/gmp++.h
index c4f41f6..4f3fadd 100644
--- a/src/kernel/gmp++/gmp++.h
+++ b/src/kernel/gmp++/gmp++.h
@@ -14,6 +14,13 @@
 #include <climits> // required by gcc 4.3
 #include <givaro-config.h>
 
+
+#ifdef __GIVARO_INLINE_ALL
+#define giv_all_inlined inline
+#else
+#define giv_all_inlined
+#endif
+
 #ifndef __GIVARO__DONOTUSE_longlong__
 #define __USE_64_bits__
 #endif
@@ -43,5 +50,6 @@ extern "C" {
 #endif
 
 #include <gmp++/gmp++_int.h>
+#include <gmp++/gmp++_rat.h>
 
 #endif // __GIVARO_GMPplusplus_H
diff --git a/src/kernel/gmp++/gmp++_int.C b/src/kernel/gmp++/gmp++_int.C
index 3d3daba..83f6ed9 100644
--- a/src/kernel/gmp++/gmp++_int.C
+++ b/src/kernel/gmp++/gmp++_int.C
@@ -1,13 +1,11 @@
 // Copyright(c)'1994-2009 by The Givaro group
 // This file is part of Givaro.
 // Givaro is governed by the CeCILL-B license under French law
-// and abiding by the rules of distribution of free software. 
+// and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 #ifndef __GMPplusplus_INTEGER_C__
 #define __GMPplusplus_INTEGER_C__
 
-#include "gmp++/gmp++.h"
-
 #include "gmp++_int_cstor.C"
 #include "gmp++_int_add.C"
 #include "gmp++_int_sub.C"
@@ -21,3 +19,4 @@
 #include "gmp++_int_io.C"
 
 #endif
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int.h b/src/kernel/gmp++/gmp++_int.h
index d3d409c..bec06aa 100644
--- a/src/kernel/gmp++/gmp++_int.h
+++ b/src/kernel/gmp++/gmp++_int.h
@@ -13,8 +13,6 @@
 #ifndef __GIVARO_GMPplusplus_integer_H
 #define __GIVARO_GMPplusplus_integer_H
 
-
-
 /*! @file kernel/gmp++/gmp++_int.h
  * @ingroup integers
  * Core gmp++_int.h.
@@ -23,7 +21,12 @@
 #include <vector>
 #include <list>
 #include <string>
+#include <assert.h>
+// #include <iostream>
 
+#ifndef __GIVARO_GMPplusplus_H
+#warning "you should include <gmp++/gmp++.h> before <gmp++/gmp++_int.h> (or prepare for the worse)"
+#endif
 
 #ifdef __USE_64_bits__
 #    define __USE_GMPPLUSPLUS_SIXTYFOUR__
@@ -39,295 +42,839 @@ namespace Givaro {
 	// forward declaration.
 	class Integer;
 
-	int 		compare(const Integer& a, const Integer& b);
-	int 		absCompare(const Integer& a, const Integer& b);
+	// (FILE gmp++_int_gcd.C)
 	Integer& 	inv (Integer& u, const Integer& a, const Integer& b);
 	Integer& 	invin (Integer& u, const Integer& b);
+
 	Integer 	gcd (const Integer& a, const Integer& b);
-	Integer 	gcd (const Integer& a, const Integer& b, Integer& u, Integer& v);
+	Integer 	gcd (Integer& u, Integer& v,const Integer& a, const Integer& b);
 	Integer& 	gcd (Integer& g, const Integer& a, const Integer& b);
-	Integer& 	gcd (Integer& g, const Integer& a, const Integer& b, Integer& u, Integer& v);
+	Integer& 	gcd (Integer& g, Integer& u, Integer& v, const Integer& a, const Integer& b);
 	Integer 	pp( const Integer& P, const Integer& Q );
 	Integer& 	lcm (Integer& g, const Integer& a, const Integer& b);
 	Integer 	lcm (const Integer& a, const Integer& b);
-	Integer& 	pow(Integer& Res, const Integer& n, const long l);
-	Integer& 	pow(Integer& Res, const unsigned long n, const unsigned long l);
-	Integer& 	pow(Integer& Res, const Integer& n, const unsigned long l);
+
+	// (FILE gmp++_int_pow.C)
+	Integer& 	pow(Integer& Res, const Integer& n, const long int l);
+	Integer& 	pow(Integer& Res, const long unsigned int n, const long unsigned int l);
+	Integer& 	pow(Integer& Res, const Integer& n, const long unsigned int l);
 	Integer& 	pow(Integer& Res, const Integer& n, const int l) ;
 	Integer& 	pow(Integer& Res, const Integer& n, const unsigned int l) ;
-	Integer 	pow(const Integer& n, const long l);
-	Integer 	pow(const Integer& n, const unsigned long l);
+	Integer 	pow(const Integer& n, const long int l);
+	Integer 	pow(const Integer& n, const long unsigned int l);
 	Integer 	pow(const Integer& n, const int l) ;
 	Integer 	pow(const Integer& n, const unsigned int l);
-	Integer& 	powmod(Integer& Res, const Integer& n, const unsigned long e, const Integer& m);
-	Integer& 	powmod(Integer& Res, const Integer& n, const long e, const Integer& m);
+
+	Integer& 	powmod(Integer& Res, const Integer& n, const long unsigned int e, const Integer& m);
+	Integer& 	powmod(Integer& Res, const Integer& n, const long int e, const Integer& m);
 	Integer& 	powmod(Integer& Res, const Integer& n, const unsigned int e, const Integer& m) ;
 	Integer& 	powmod(Integer& Res, const Integer& n, const int e, const Integer& m)  ;
 	Integer& 	powmod(Integer& Res, const Integer& n, const Integer& e, const Integer& m);
-	Integer 	powmod(const Integer& n, const unsigned long e, const Integer& m);
-	Integer 	powmod(const Integer& n, const long e, const Integer& m);
+	Integer 	powmod(const Integer& n, const long unsigned int e, const Integer& m);
+	Integer 	powmod(const Integer& n, const long int e, const Integer& m);
 	Integer 	powmod(const Integer& n, const unsigned int e, const Integer& m) ;
 	Integer 	powmod(const Integer& n, const int e, const Integer& m) ;
 	Integer 	powmod(const Integer& n, const Integer& e, const Integer& m);
-	Integer 	fact ( unsigned long l);
+
+	// (FILE inline)
+	int 		sign   (const Integer& a);
+
+	// (FILE gmp++_int_compare.C)
+	int 		compare(const Integer& a, const Integer& b);
+
+	int 		absCompare(const Integer& a, const Integer& b);
+	int 		absCompare(const Integer& a, const double b);
+	int 		absCompare(const Integer& a, const float b);
+	int 		absCompare(const Integer& a, const long unsigned b);
+	int 		absCompare(const Integer& a, const unsigned b);
+	int 		absCompare(const Integer& a, const long int b);
+	int 		absCompare(const Integer& a, const int b);
+	template<class T>
+	int             absCompare( const T a,  const Integer & b)
+	{
+		return absCompare(b,a);
+	}
+
+	int 		isZero (const Integer& a);
+	int 		nonZero (const Integer& a);
+	int 		isOne  (const Integer& a);
+
+	// (FILE gmp++_int_misc.C)
+	Integer 	fact ( long unsigned int l);
+
 	Integer 	sqrt(const Integer& p);
 	Integer 	sqrtrem(const Integer& p, Integer& rem);
 	Integer& 	sqrt(Integer& r, const Integer& p);
 	Integer& 	sqrtrem(Integer& r, const Integer& p, Integer& rem);
 	bool 		root(Integer& q, const Integer&, unsigned int n);
+
 	long 		logp(const Integer& a, const Integer& p) ;
 	double 		logtwo(const Integer& a) ;
 	double 		naturallog(const Integer& a) ;
+
 	void 		swap(Integer& , Integer&);
-	int 		sign   (const Integer& a);
-	int 		isZero (const Integer& a);
-	int 		isOne  (const Integer& a);
+
 	int 		isperfectpower  (const Integer& );
+
 	Integer 	abs(const Integer& n);
+
 	Integer& 	prevprime(Integer&, const Integer& p);
 	Integer& 	nextprime(Integer&, const Integer& p);
 	int 		probab_prime(const Integer& p);
 	int 		probab_prime(const Integer& p, int r);
 	int 		jacobi(const Integer& u, const Integer& v) ;
 	int 		legendre(const Integer& u, const Integer& v) ;
-	unsigned long 	length (const Integer& a);
+
+	long unsigned 	length (const Integer& a);
+	// (FILE gmp++_int_io.C)
+
 	std::istream& 	operator >> (std::istream &i, Integer& n);
 	std::ostream& 	operator << (std::ostream &o, const Integer& n);
 	std::ostream& 	absOutput (std::ostream &o, const Integer& n);
 	void 		importWords(Integer&, size_t, int, int, int, size_t, const void*);
 
-
 	//------------------------------------------------------ Class Integer
 	/*! @ingroup integers
 	 * This is the Integer class.
 	 * An Integer is represented as a GMP integer.
 	 * This class provides arithmetic on Integers.
 	 */
-	class Integer
-	{
+	class Integer {
 
 	public:
 		//! vector of limbs (ie a gmp number).
 		typedef std::vector<mp_limb_t> vect_t;
 		//--------------------------------------cstors & dstors
-		/*! @name Constructor/Destructors
-		*/
-		//@{
-		Integer( const std::vector<mp_limb_t>& vect_t );
-		Integer(int n = 0);
-		Integer(long n);
-		Integer(unsigned char n);
-		Integer(unsigned int n);
-		Integer(unsigned long n);
+		// (FILE gmp++_cstor.C)
+		/*! @name Constructor/Destructors.
+		 * Constructors and destructor for an Integer.
+		 */
+		/// Constructor form a known type.
+		///@param n input to be constructed from
+		giv_all_inlined Integer(int n = 0);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(long int n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(unsigned char n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(unsigned int n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(long unsigned int n);
 #ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-		Integer(long long n);
-		Integer(unsigned long long n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(long long int n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(long long unsigned int n);
 #endif
-		Integer(double d);
-		Integer(const char *s);
-		Integer(const Integer& n);
-		~Integer();
-		//@}
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(double n);
+		//! @overload Givaro::Integer(int)
+		giv_all_inlined Integer(const char *n);
+
+		/*! Copy constructor
+		 * @param n input to be constructed from
+		 */
+		giv_all_inlined Integer(const Integer& n);
+
+		/*! Creates a new Integer from pointers.
+		 * @param d array
+		 * @param sz size
+		 */
+		giv_all_inlined Integer(long unsigned* d, long sz);
+		/*! Creates a new Integers for a vector of limbs
+		* @param v vector of limbs
+		*/
+		giv_all_inlined Integer( const vect_t &v);
+
+		//! destructor
+		giv_all_inlined ~Integer();
+		///@}
 
 		//------------------------------------- predefined null and one
-		//! zero
-		static const Integer zero;
-		//! one
-		static const Integer one;
+		//! zero (0)
+		static const Integer zero ;
+		//! one (1)
+		static const Integer one ;
+		//! minus one (-1)
+		static const Integer mOne ;
+
+
 
 		// -- Assignment and copy operators
-		/*! @name Assignment and copy operators
-		*/
-		//@{
-		Integer& operator = (const Integer& n);
-		Integer& logcpy(const Integer& n);
-		Integer& copy(const Integer& n);
-		//@}
+		/*! @name Assignment and copy operators */
+		/*! copy from an integer.
+		 * @param n integer to copy.
+		 */
+		///@{
+		giv_all_inlined Integer& operator = (const Integer& n);
+		giv_all_inlined Integer& logcpy(const Integer& n);
+		giv_all_inlined Integer& copy(const Integer& n);
+		///@}
 
 		//------------------Equalities and inequalities between integers and longs
-		/*! @name (in)equality
-		*/
-		//@{
-		int operator != (const int l) const;
-		int operator != (const long l) const;
-		int operator != (const unsigned long l) const;
-
-		friend int compare(const Integer& a, const Integer& b);
-		friend int absCompare(const Integer& a, const Integer& b);
-
-		int operator > (const int l) const;
-		int operator > (const long l) const;
-		int operator > (const unsigned long l) const;
-		int operator < (const int l) const;
-		int operator < (const long l) const;
-		int operator < (const unsigned long l) const;
-		//@}
-
-		//------------------ Bit logic
-		/*!@name Bit logic
-		*/
-		//@{
-		Integer operator^ (const Integer&) const;   // XOR
-		Integer operator| (const Integer&) const;   // OR
-		Integer operator& (const Integer&) const;   // AND
-		unsigned long operator^ (const unsigned long& a) const;
-		unsigned long operator| (const unsigned long& a) const;
-		unsigned long operator& (const unsigned long& a) const;
-		Integer operator ~ () const;   // 1 complement
-		Integer& operator^= (const Integer&);   // XOR
-		Integer& operator|= (const Integer&);   // OR
-		Integer& operator&= (const Integer&);   // AND
-		Integer operator<< (int l) const; // lshift
-		Integer operator>> (int l) const; // rshift
-		Integer operator<< (long l) const; // lshift
-		Integer operator>> (long l) const; // rshift
-		Integer operator<< (unsigned int l) const; // lshift
-		Integer operator>> (unsigned int l) const; // rshift
-		Integer operator<< (unsigned long l) const; // lshift
-		Integer operator>> (unsigned long l) const; // rshift
-		Integer& operator<<= (int l) ; // lshift
-		Integer& operator>>= (int l) ; // rshift
-		Integer& operator<<= (long l) ; // lshift
-		Integer& operator>>= (long l) ; // rshift
-		Integer& operator<<= (unsigned int l) ; // lshift
-		Integer& operator>>= (unsigned int l) ; // rshift
-		Integer& operator<<= (unsigned long l) ; // lshift
-		Integer& operator>>= (unsigned long l) ; // rshift
-		//@}
+		// (FILE gmp++_int_compare.C)
+		//! @name Comparisons functions.
+		///@{
+		/*! Compares two integers.
+		 * @param a integer
+		 * @param b integer
+		 * @return \c 1 if \f$a > b\f$, \c 0 if \f$a = b\f$ and \p -1 otherwise.
+		 */
+		giv_all_inlined friend int compare(const Integer& a, const Integer& b);
+
+		/** Compare the norm of two integers.
+		 * @param a integer
+		 * @param b integer
+		 * @return \c 1 if \f$|a| > |b|\f$, \c 0 if \f$|a| = |b|\f$ and \p -1 otherwise.
+		 */
+		giv_all_inlined friend int absCompare(const Integer& a, const Integer& b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const double b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const float b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const long unsigned b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const unsigned b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const long int b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		giv_all_inlined friend int absCompare(const Integer& a, const int b);
+		/** @overload Integer::absCompare(Integer, Integer) */
+		template<class T>
+		giv_all_inlined friend int absCompare( const T a,  const Integer & b) ;
+
+		//! name compare to 1 and 0
+		//! @param a
+		friend giv_all_inlined  int isOne(const Integer& a);
+
+
+
+		//! name compare to 1 and 0
+		//! @param a
+		friend giv_all_inlined  int nonZero(const Integer& a);
+
+		//! name compare to 1 and 0
+		//! @param a
+		friend giv_all_inlined  int isZero(const Integer& a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const short int a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const int a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const long int a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const unsigned short int a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const unsigned int a);
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const long unsigned int a);
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+#if 1 /*  use of C++0x long long integer constant */
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const long long unsigned int a);
+#endif
+		//! @overload Givaro::isZero(Integer);
+		friend giv_all_inlined  int isZero(const long long int a);
+#endif
+		//! isleq
+		//! @param a,b
+		template<class A,class B>
+		static giv_all_inlined bool isleq(const A&a,const B&b)
+		{
+		       	return a<=b ;
+	       	}
+
+		///@}
+
+
+		/** @name Comparison operators.
+		 * @brief Compare with operators.
+		 */
+		///@{
+		/** greater or equal.
+		 * @param l integer to be compared to
+		 */
+		giv_all_inlined int operator >= (const Integer & l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const int l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const long int l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const long unsigned int l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const unsigned int l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const double l) const;
+		/** @overload Integer::operator>=(Integer) */
+		giv_all_inlined int operator >= (const float l) const;
+
+		//! greater or equal.
+		/// @param l,n integers to compare
+		giv_all_inlined friend int operator >= (unsigned int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator >= (float l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator >= (double l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator >= (int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator >= (long int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator >= (long unsigned int l, const Integer& n);
+
+
+		//! less or equal
+		/// @param l integer to be compared to
+		giv_all_inlined int operator <= (const Integer & l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const int l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const long int l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const long unsigned int l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const unsigned int l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const double l) const;
+		/** @overload Integer::operator<=(Integer) */
+		giv_all_inlined int operator <= (const float l) const;
+
+		//! less or equal
+		/// @param l,n integers to compare
+		giv_all_inlined friend int operator <= (unsigned int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator <= (float l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator <= (double l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator <= (int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator <= (long int l, const Integer& n);
+		/** @overload Integer::operator>=(unsigned, Integer) */
+		giv_all_inlined friend int operator <= (long unsigned int l, const Integer& n);
+
+		/*! operator != (not equal)
+		 * @param l integer
+		 * @return \c 1 iff l == this
+		 */
+		giv_all_inlined int operator != (const Integer & l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const int l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const long int l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const long unsigned int l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const unsigned int l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const double l) const;
+		/** @overload Integer::operator!=(Integer) */
+		giv_all_inlined int operator != (const float l) const;
+
+		/*! operator != (not equal)
+		 * @param l,n integer
+		 * @return \c 1 iff l == n
+		 */
+		giv_all_inlined friend int operator != (unsigned int l, const Integer& n);
+		/** @overload Integer::operator!=(unsigned, Integer) */
+		giv_all_inlined friend int operator != (float l, const Integer& n);
+		/** @overload Integer::operator!=(unsigned, Integer) */
+		giv_all_inlined friend int operator != (double l, const Integer& n);
+		/** @overload Integer::operator!=(unsigned, Integer) */
+		giv_all_inlined friend int operator != (int l, const Integer& n);
+		/** @overload Integer::operator!=(unsigned, Integer) */
+		giv_all_inlined friend int operator != (long int l, const Integer& n);
+		/** @overload Integer::operator!=(unsigned, Integer) */
+		giv_all_inlined friend int operator != (long unsigned int l, const Integer& n);
+
+
+		//! Equality
+		/// @param l integer to be compared to
+		giv_all_inlined int operator == (const Integer & l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const int l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const long int l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const long unsigned int l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const unsigned int l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const double l) const;
+		/** @overload Integer::operator==(Integer) */
+		giv_all_inlined int operator == (const float l) const;
+
+		//! Equality
+		/// @param l,n integers to compare
+		giv_all_inlined friend int operator == (unsigned int l, const Integer& n);
+		/** @overload Integer::operator==(unsigned, Integer) */
+		giv_all_inlined friend int operator == (float l, const Integer& n);
+		/** @overload Integer::operator==(unsigned, Integer) */
+		giv_all_inlined friend int operator == (double l, const Integer& n);
+		/** @overload Integer::operator==(unsigned, Integer) */
+		giv_all_inlined friend int operator == (int l, const Integer& n);
+		/** @overload Integer::operator==(unsigned, Integer) */
+		giv_all_inlined friend int operator == (long int l, const Integer& n);
+		/** @overload Integer::operator==(unsigned, Integer) */
+		giv_all_inlined friend int operator == (long unsigned int l, const Integer& n);
+
+
+		//! greater (strict)
+		/// @param l integer to be compared to
+		giv_all_inlined int operator > (const Integer & l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const int l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const long int l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const long unsigned int l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const unsigned int l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const double l) const;
+		/** @overload Integer::operator>(Integer) */
+		giv_all_inlined int operator > (const float l) const;
+
+		//! greater (strict)
+		/// @param l,n integers to compare
+		giv_all_inlined friend int operator > (unsigned int l, const Integer& n);
+		/** @overload Integer::operator>(unsigned, Integer) */
+		giv_all_inlined friend int operator > (float l, const Integer& n);
+		/** @overload Integer::operator>(unsigned, Integer) */
+		giv_all_inlined friend int operator > (double l, const Integer& n);
+		/** @overload Integer::operator>(unsigned, Integer) */
+		giv_all_inlined friend int operator > (int l, const Integer& n);
+		/** @overload Integer::operator>(unsigned, Integer) */
+		giv_all_inlined friend int operator > (long int l, const Integer& n);
+		/** @overload Integer::operator>(unsigned, Integer) */
+		giv_all_inlined friend int operator > (long unsigned int l, const Integer& n);
+
+		//! less (strict)
+		/// @param l integer to be compared to
+		giv_all_inlined int operator < (const Integer & l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const int l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const long int l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const long unsigned int l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const unsigned int l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const double l) const;
+		/** @overload Integer::operator<(Integer) */
+		giv_all_inlined int operator < (const float l) const;
+
+		//! less (strict)
+		/// @param l,n integers to compare
+		giv_all_inlined friend int operator < (unsigned int l, const Integer& n);
+		/** @overload Integer::operator<(unsigned, Integer) */
+		giv_all_inlined friend int operator < (float l, const Integer& n);
+		/** @overload Integer::operator<(unsigned, Integer) */
+		giv_all_inlined friend int operator < (double l, const Integer& n);
+		/** @overload Integer::operator<(unsigned, Integer) */
+		giv_all_inlined friend int operator < (int l, const Integer& n);
+		/** @overload Integer::operator<(unsigned, Integer) */
+		giv_all_inlined friend int operator < (long int l, const Integer& n);
+		/** @overload Integer::operator<(unsigned, Integer) */
+		giv_all_inlined friend int operator < (long unsigned int l, const Integer& n);
+		///@}
+
+		// ---------------- Bit logic
+		// (FILE gmp++_int_misc.C)
+
+		/*! @name Bit logic operators.  */
+		///@{
+		//! @brief XOR (^)
+		//! @param a integer
+		giv_all_inlined Integer operator^ (const Integer& a) const;   // XOR
+		/** @overload Integer::operator^(Integer) */
+		giv_all_inlined Integer operator^ (const long unsigned int & a) const;
+		/** @overload Integer::operator^(Integer) */
+		giv_all_inlined Integer operator^ (const unsigned int& a) const;
+		//! @brief XOR inplace (^=)
+		//! @param a integer
+		giv_all_inlined Integer& operator^= (const Integer&a);   // XOR
+		/** @overload Integer::operator^=(Integer) */
+		giv_all_inlined Integer& operator^= (const long unsigned int & a);   // XOR
+		/** @overload Integer::operator^=(Integer) */
+		giv_all_inlined Integer& operator^= (const unsigned int&a);   // XOR
+
+		//! OR (|)
+		//! @param a integer
+		giv_all_inlined Integer operator| (const Integer& a ) const;   // OR
+		/** @overload Integer::operator|(Integer) */
+		giv_all_inlined Integer operator| (const long unsigned int & a) const;
+		/** @overload Integer::operator|(Integer) */
+		giv_all_inlined Integer operator| (const unsigned int& a) const;
+		//! OR inplace (|=)
+		//! @param a integer
+		giv_all_inlined Integer& operator|= (const Integer& a );   // OR
+		/** @overload Integer::operator|=(Integer) */
+		giv_all_inlined Integer& operator|= (const long unsigned int & a );   // OR
+		/** @overload Integer::operator|=(Integer) */
+		giv_all_inlined Integer& operator|= (const unsigned int& a );   // OR
+
+		//! AND (&)
+		//! @param a integer
+		giv_all_inlined Integer operator& (const Integer&a) const;   // AND
+		/** @overload Integer::operator&(Integer) */
+		giv_all_inlined unsigned int operator& (const unsigned int& a) const;
+		/** @overload Integer::operator&(Integer) */
+		giv_all_inlined long unsigned operator& (const long unsigned int & a) const;
+
+		//! AND inplace (&=)
+		//! @param a integer
+		giv_all_inlined Integer& operator&= (const Integer&a);   // AND
+		/** @overload Integer::operator&=(Integer) */
+		giv_all_inlined Integer& operator&= (const long unsigned int &a);   // AND
+		/** @overload Integer::operator&=(Integer) */
+		giv_all_inlined Integer& operator&= (const unsigned int&a);   // AND
+
+		//! complement to 1 (~)
+		giv_all_inlined Integer operator ~ () const;   // 1 complement
+
+		//! left shift (<<)
+		//! @param l shift
+		giv_all_inlined Integer operator<< (int l) const; // lshift
+		/** @overload Integer::operator<<(int) */
+		giv_all_inlined Integer operator<< (long int l) const; // lshift
+		/** @overload Integer::operator<<(int) */
+		giv_all_inlined Integer operator<< (unsigned int l) const; // lshift
+		/** @overload Integer::operator<<(int) */
+		giv_all_inlined Integer operator<< (long unsigned int l) const; // lshift
+
+		//! left shift inplace (<<=)
+		//! @param l shift
+		giv_all_inlined Integer& operator<<= (int l) ; // lshift
+		/** @overload Integer::operator<<=(int) */
+		giv_all_inlined Integer& operator<<= (long int l) ; // lshift
+		/** @overload Integer::operator<<=(Integer) */
+		giv_all_inlined Integer& operator<<= (unsigned int l) ; // lshift
+		/** @overload Integer::operator<<=(Integer) */
+		giv_all_inlined Integer& operator<<= (long unsigned int l) ; // lshift
+
+		//! right shift (>>)
+		//! @param l shift
+		giv_all_inlined Integer operator>> (int l) const; // rshift
+		/** @overload Integer::operator>>(int) */
+		giv_all_inlined Integer operator>> (long int l) const; // rshift
+		/** @overload Integer::operator>>(int) */
+		giv_all_inlined Integer operator>> (unsigned int l) const; // rshift
+		/** @overload Integer::operator>>(int) */
+		giv_all_inlined Integer operator>> (long unsigned int l) const; // rshift
+
+		//! right shift inplace (>>=)
+		//! @param l shift
+		giv_all_inlined Integer& operator>>= (int l) ; // rshift
+		/** @overload Integer::operator>>=(int) */
+		giv_all_inlined Integer& operator>>= (long int l) ; // rshift
+		/** @overload Integer::operator>>=(int) */
+		giv_all_inlined Integer& operator>>= (unsigned int l) ; // rshift
+		/** @overload Integer::operator>>=(int) */
+		giv_all_inlined Integer& operator>>= (long unsigned int l) ; // rshift
+		///@}
+
 
 		// - Methods
-		/*! @name Addition, substraction, multiplication
-		*/
-		//@{
+		/*! @name Addition, substraction, multiplication */
+		///@{
+		// (FILE gmp++_int_add.C)
 		/*!  Addition (inplace)
 		 * <code>res+=n</code>.
 		 * @param res as in the formula
 		 * @param n as in the formula
 		 */
-		static Integer& addin (Integer& res, const Integer& n);
-		static Integer& addin (Integer& res, const long n);
-		static Integer& addin (Integer& res, const unsigned long n);
+		static giv_all_inlined  Integer& addin (Integer& res, const Integer& n);
+		/** @overload Integer::addin(Integer,Integer) */
+		static giv_all_inlined  Integer& addin (Integer& res, const long int n);
+		/** @overload Integer::addin(Integer,Integer) */
+		static giv_all_inlined  Integer& addin (Integer& res, const long unsigned int n);
+
 		/*!  Addition
 		 * <code>res=n1+n2</code>.
 		 * @param res as in the formula
 		 * @param n1 as in the formula
 		 * @param n2 as in the formula
 		 */
-		static Integer& add   (Integer& res, const Integer& n1, const Integer& n2);
-		static Integer& add   (Integer& res, const Integer& n1, const long n2);
-		static Integer& add   (Integer& res, const Integer& n1, const unsigned long n2);
+		static giv_all_inlined  Integer& add   (Integer& res, const Integer& n1, const Integer& n2);
+		/** @overload Integer::add(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& add   (Integer& res, const Integer& n1, const long int n2);
+		/** @overload Integer::add(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& add   (Integer& res, const Integer& n1, const long unsigned int n2);
 
+		// (FILE gmp++_int_sub.C)
 		/*!  Substraction (inplace)
 		 * <code>res-=n</code>.
 		 * @param res as in the formula
 		 * @param n as in the formula
 		 */
-		static Integer& subin (Integer& res, const Integer& n);
-		static Integer& subin (Integer& res, const long n);
-		static Integer& subin (Integer& res, const unsigned long n);
+		static giv_all_inlined  Integer& subin (Integer& res, const Integer& n);
+		/** @overload Integer::subin(Integer,Integer) */
+		static giv_all_inlined  Integer& subin (Integer& res, const long int n);
+		/** @overload Integer::subin(Integer,Integer) */
+		static giv_all_inlined  Integer& subin (Integer& res, const long unsigned int n);
+
 		/*!  Substraction
 		 * <code>res=n1-n2</code>.
 		 * @param res as in the formula
 		 * @param n1 as in the formula
 		 * @param n2 as in the formula
 		 */
-		static Integer& sub   (Integer& res, const Integer& n1, const Integer& n2);
-		static Integer& sub   (Integer& res, const Integer& n1, const long n2);
-		static Integer& sub   (Integer& res, const Integer& n1, const unsigned long n2);
+		static giv_all_inlined  Integer& sub   (Integer& res, const Integer& n1, const Integer& n2);
+		/** @overload Integer::sub(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& sub   (Integer& res, const Integer& n1, const long int n2);
+		/** @overload Integer::sub(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& sub   (Integer& res, const Integer& n1, const long unsigned int n2);
+
 		/*!  Negation (inplace)
 		 * <code>res=-res</code>.
 		 * @param res as in the formula
 		 */
-		static Integer& negin (Integer& res);
+		static giv_all_inlined  Integer& negin (Integer& res);
 		/*!  Negation
 		 * <code>res=-n</code>.
 		 * @param n as in the formula
 		 * @param res as in the formula
 		 */
-		static Integer& neg   (Integer& res, const Integer& n);
+		static giv_all_inlined  Integer& neg   (Integer& res, const Integer& n);
 
 		/*!  Multiplication (inplace)
 		 * <code>res*=n</code>.
 		 * @param res as in the formula
 		 * @param n as in the formula
 		 */
-		static Integer& mulin (Integer& res, const Integer& n);
-		static Integer& mulin (Integer& res, const long n);
-		static Integer& mulin (Integer& res, const unsigned long n);
+		static giv_all_inlined  Integer& mulin (Integer& res, const Integer& n);
+		/** @overload Integer::mulin(Integer,Integer) */
+		static giv_all_inlined  Integer& mulin (Integer& res, const long int n);
+		/** @overload Integer::mulin(Integer,Integer) */
+		static giv_all_inlined  Integer& mulin (Integer& res, const long unsigned int n);
+
 		/*! Multiplication
 		 * <code>res=n1*n2</code>.
 		 * @param res as in the formula
 		 * @param n1 as in the formula
 		 * @param n2 as in the formula
 		 */
-		static Integer& mul   (Integer& res, const Integer& n1, const Integer& n2);
-		static Integer& mul   (Integer& res, const Integer& n1, const long n2);
-		static Integer& mul   (Integer& res, const Integer& n1, const unsigned long n2);
+		static giv_all_inlined  Integer& mul   (Integer& res, const Integer& n1, const Integer& n2);
+		/** @overload Integer::mul(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& mul   (Integer& res, const Integer& n1, const long int n2);
+		/** @overload Integer::mul(Integer,Integer,Integer) */
+		static giv_all_inlined  Integer& mul   (Integer& res, const Integer& n1, const long unsigned int n2);
+		///@}
 
 		//----------------Elementary arithmetic between Integers & longs
+		// (FILE gmp++_int_add.C)
+		/*! @name Addition, substraction, multiplication operators*/
+		///@{
 		/*! operator \c +.
 		 * @return <code> (*this)+n</code>
 		 * @param n as in the formula.
 		 */
-		Integer  operator + (const Integer& n) const;
-		Integer  operator + (const unsigned long n) const;
-		Integer  operator + (const long n) const;
+		giv_all_inlined Integer  operator + (const Integer& n) const;
+		/** @overload Integer::operator+(Integer) */
+		giv_all_inlined Integer  operator + (const long unsigned int n) const;
+		/** @overload Integer::operator+(Integer) */
+		giv_all_inlined Integer  operator + (const long int n) const;
+
 		/*! operator \c += .
-		 * @param n as in the formula.
+		 * @param n asfriend In the formula.
 		 * @return <code> (*this) += n</code>.
 		 */
-		Integer& operator += (const Integer& n);
-		Integer& operator += (const unsigned long n);
-		Integer& operator += (const long n);
+		giv_all_inlined Integer& operator += (const Integer& n);
+		/** @overload Integer::operator+=(Integer) */
+		giv_all_inlined Integer& operator += (const long unsigned int n);
+		/** @overload Integer::operator+=(Integer) */
+		giv_all_inlined Integer& operator += (const long int n);
+		/** @overload Integer::operator+=(Integer) */
 		template<class XXX>
-		Integer& operator +=(const XXX& n) { return this->operator += ( (Integer)n ); }
+		Integer& operator +=(const XXX& n) {
+			return this->operator += ( (Integer)n );
+		}
+
+		// - Friends
+		//! operator +.
+		//! @param l,n to be added
+		friend giv_all_inlined  Integer operator + (const int l, const Integer& n);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined  Integer operator + (const unsigned int l, const Integer& n);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined  Integer operator + (const long int l, const Integer& n);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined  Integer operator + (const long unsigned int l, const Integer& n);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined  Integer operator + (const Integer& n, const int l);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined  Integer operator + (const Integer& n, const unsigned int l);
+
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined 	Integer operator + (const Integer& n, const long long int l);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined 	Integer operator + (const Integer& n, const long long unsigned int l);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined 	Integer operator + (const long long int l, const Integer& n);
+		/** @overload friend Integer::operator+(int,Integer) */
+		friend giv_all_inlined 	Integer operator + (const long long unsigned int l, const Integer& n);
+#endif
+
+		//! operator +=.
+		//! @param n Integer
+		//! @param l to be added up
+		friend giv_all_inlined  Integer& operator += (Integer& n, const int l);
+		/** @overload friend Integer::operator+=(Integer,int) */
+		friend giv_all_inlined  Integer& operator += (Integer& n, const unsigned int l);
+		/** @overload friend Integer::operator+=(Integer,int) */
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+		friend giv_all_inlined 	Integer& operator += (Integer& n, const long long int l);
+		/** @overload friend Integer::operator+=(Integer,int) */
+		friend giv_all_inlined 	Integer& operator += (Integer& n, const long long unsigned int l);
+#endif
+
+
+		// (FILE gmp++_int_sub.C)
 
 		/*! operator \c -.
 		 * @return <code> (*this)-n</code>
 		 * @param n as in the formula.
 		 */
-		Integer  operator - (const Integer& n) const;
-		Integer  operator - (const unsigned long n) const;
-		Integer  operator - (const long n) const;
+		giv_all_inlined Integer  operator - (const Integer& n) const;
+		/** @overload Integer::operator-(Integer) */
+		giv_all_inlined Integer  operator - (const long unsigned int n) const;
+		/** @overload Integer::operator-(Integer) */
+		giv_all_inlined Integer  operator - (const long int n) const;
+
 		/*! operator \c -= .
 		 * @param n as in the formula.
 		 * @return <code> (*this) -= n</code>.
 		 */
-		Integer& operator -= (const Integer& n);
-		Integer& operator -= (const unsigned long n);
-		Integer& operator -= (const long n);
+		giv_all_inlined Integer& operator -= (const Integer& n);
+		/** @overload Integer::operator-=(Integer) */
+		giv_all_inlined Integer& operator -= (const long unsigned int n);
+		/** @overload Integer::operator-=(Integer) */
+		giv_all_inlined Integer& operator -= (const long int n);
+		/** @overload Integer::operator-=(Integer) */
 		template<class XXX>
-		Integer& operator -=(const XXX& n) { return this->operator -= ( (Integer)n ); }
+		Integer& operator -=(const XXX& n)
+		{
+			return this->operator -= ( (Integer)n );
+		}
 
 		/*! Opposite.
 		 * \return <code>-(*this)</code>.
 		 */
-		Integer  operator -() const;
+		giv_all_inlined Integer  operator -() const;
+
+
+		//! operator -
+		//! @param l,n to be substracted
+		friend giv_all_inlined  Integer operator - (const int l, const Integer& n);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const unsigned int l, const Integer& n);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const long int l, const Integer& n);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const long unsigned int l, const Integer& n);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const Integer& n, const int l);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const Integer& n, const unsigned int l);
+
+		//! operator -=
+		//! @param l,n to be substracted
+		friend giv_all_inlined  Integer& operator -= (Integer& n, const int l);
+		/** @overload friend Integer::operator-=(Integer,int) */
+		friend giv_all_inlined  Integer& operator -= (Integer& n, const unsigned int l);
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const Integer& n, const long long int l);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const Integer& n, const long long unsigned int l);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const long long int l, const Integer& n);
+		/** @overload friend Integer::operator-(int,Integer) */
+		friend giv_all_inlined  Integer operator - (const long long unsigned int l, const Integer& n);
+
+		/** @overload friend Integer::operator-=(Integer,int) */
+		friend giv_all_inlined  Integer& operator -= (Integer& n, const long long int l);
+		/** @overload friend Integer::operator-=(Integer,int) */
+		friend giv_all_inlined  Integer& operator -= (Integer& n, const long long unsigned int l);
+#endif
+
+		// (FILE gmp++_int_mul.C)
 
 		/*! operator \c *.
 		 * @return <code> (*this)*n</code>
 		 * @param n as in the formula.
 		 */
-		Integer  operator * (const Integer& n) const;
-		Integer  operator * (const unsigned long n) const;
-		Integer  operator * (const long n) const;
+		giv_all_inlined Integer  operator * (const Integer& n) const;
+		/** @overload Integer::operator*(Integer) */
+		giv_all_inlined Integer  operator * (const long unsigned int n) const;
+		/** @overload Integer::operator*(Integer) */
+		giv_all_inlined Integer  operator * (const long int n) const;
+
 		/*! operator \c *= .
 		 * @param n as in the formula.
 		 * @return <code> (*this) *= n</code>.
 		 */
-		Integer& operator *= (const Integer& n);
-		Integer& operator *= (const unsigned long n);
-		Integer& operator *= (const long n);
+		giv_all_inlined Integer& operator *= (const Integer& n);
+		/** @overload Integer::operator*=(Integer) */
+		giv_all_inlined Integer& operator *= (const long unsigned int n);
+		/** @overload Integer::operator*=(Integer) */
+		giv_all_inlined Integer& operator *= (const long int n);
+		/** @overload Integer::operator*=(Integer) */
 		template<class XXX>
-		Integer& operator *=(const XXX& n) { return this->operator *= ( (Integer)n ); }
-		//@}
+		Integer& operator *=(const XXX& n) {
+			return this->operator *= ( (Integer)n );
+		}
+
+		//! operator *
+		//! @param l,n to be multpct
+		friend giv_all_inlined  Integer operator * (const int l, const Integer& n);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const unsigned int l, const Integer& n);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const long int l, const Integer& n);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const long unsigned int l, const Integer& n);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const Integer& n, const int l);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const Integer& n, const unsigned int l);
+
+		//! operator *=
+		//! @param l,n to be multpct
+		friend giv_all_inlined  Integer& operator *= (Integer& n, const int l);
+		/** @overload fried Integer::operator*(Integer,int) */
+		friend giv_all_inlined  Integer& operator *= (Integer& n, const unsigned int l);
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const Integer& n, const long long int l);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const Integer& n, const long long unsigned int l);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const long long int l, const Integer& n);
+		/** @overload fried Integer::operator*(int,Integer) */
+		friend giv_all_inlined  Integer operator * (const long long unsigned int l, const Integer& n);
+
+		friend giv_all_inlined  Integer& operator *= (Integer& n, const long long int l);
+		/** @overload fried Integer::operator*(Integer,int) */
+		friend giv_all_inlined  Integer& operator *= (Integer& n, const long long unsigned int l);
+		/** @overload fried Integer::operator*(Integer,int) */
+#endif
+		///@}
 
 		/*! @name fused add-multiply
-		 * @brief
-		 * Groups a multiplication adn an addition/division is a single function.
-		 * This is usually faster than doing the two operations separately.
+		 * @brief Groups a multiplication and an addition/division in a
+		 * single function.
+		 * This is usually faster than doing the two operations
+		 * separately (and preferable to using operators).
 		 */
-		//@{
+		///@{
 		/*! axpy
 		 *  <code>res = ax+y</code>.
 		 * @param res Integers as in the forumla
@@ -335,10 +882,15 @@ namespace Givaro {
 		 * @param x Integers as in the forumla
 		 * @param y Integers as in the forumla
 		 */
-		static Integer& axpy   (Integer& res,
-					const Integer& a, const Integer& x, const Integer& y );
-		static Integer& axpy   (Integer& res,
-					const Integer& a, const unsigned long x, const Integer& y );
+		static giv_all_inlined  Integer& axpy   (Integer& res,
+							 const Integer& a,
+							 const Integer& x,
+							 const Integer& y );
+		//! @overload Integer::axpy(Integer,Integer,Integer,Integer)
+		static giv_all_inlined  Integer& axpy   (Integer& res,
+							 const Integer& a,
+							 const long unsigned int x,
+							 const Integer& y );
 
 		/*! axpyin (inplace)
 		 *  <code>res += ax</code>.
@@ -346,10 +898,13 @@ namespace Givaro {
 		 * @param a Integers as in the formula.
 		 * @param x Integers as in the formula.
 		 */
-		static Integer& axpyin   (Integer& res,
-					  const Integer& a, const Integer& x);
-		static Integer& axpyin   (Integer& res,
-					  const Integer& a, const unsigned long x);
+		static giv_all_inlined  Integer& axpyin   (Integer& res,
+							   const Integer& a,
+							   const Integer& x);
+		//! @overload Integer::axpyin(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& axpyin   (Integer& res,
+							   const Integer& a,
+							   const long unsigned int x);
 
 		/*! maxpy
 		 *  <code>res = y - ax</code>.
@@ -358,23 +913,29 @@ namespace Givaro {
 		 * @param x Integers as in the formula.
 		 * @param y Integers as in the formula.
 		 */
-		static Integer& maxpy   (Integer& res,
-					 const Integer& a, const Integer& x, const Integer& y );
-		static Integer& maxpy   (Integer& res,
-					 const Integer& a, const unsigned long x, const Integer& y );
+		static giv_all_inlined  Integer& maxpy   (Integer& res,
+							  const Integer& a,
+							  const Integer& x,
+							  const Integer& y );
+		//! @overload Integer::maxpy(Integer,Integer,Integer,Integer)
+		static giv_all_inlined  Integer& maxpy   (Integer& res,
+							  const Integer& a,
+							  const long unsigned int x,
+							  const Integer& y );
 
 		/*! maxpyin
 		 *  <code>res -= ax</code>.
 		 * @param res Integers as in the formula.
 		 * @param a Integers as in the formula.
 		 * @param x Integers as in the formula.
-		 * @param y Integers as in the formula.
 		 */
-		static Integer& maxpyin (Integer& res,
-					 const Integer& a, const Integer& x );
-		static Integer& maxpyin (Integer& res,
-					 const Integer& a, const unsigned long x );
-
+		static giv_all_inlined  Integer& maxpyin (Integer& res,
+							  const Integer& a,
+							  const Integer& x );
+		//! @overload Integer::maxpyin(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& maxpyin (Integer& res,
+							  const Integer& a,
+							  const long unsigned int x );
 
 		/*! axmy
 		 *  <code>res = ax - y</code>.
@@ -383,11 +944,15 @@ namespace Givaro {
 		 * @param x Integers as in the formula.
 		 * @param y Integers as in the formula.
 		 */
-		static Integer& axmy   (Integer& res,
-					const Integer& a, const Integer& x, const Integer& y );
-		static Integer& axmy   (Integer& res,
-					const Integer& a, const unsigned long x, const Integer & y );
-
+		static giv_all_inlined  Integer& axmy   (Integer& res,
+							 const Integer& a,
+							 const Integer& x,
+							 const Integer& y );
+		//! @overload Integer::axmy(Integer,Integer,Integer,Integer)
+		static giv_all_inlined  Integer& axmy   (Integer& res,
+							 const Integer& a,
+							 const long unsigned int x,
+							 const Integer & y );
 
 		/*! axmyin (in place)
 		 * <code>res = ax - res</code>.
@@ -395,11 +960,12 @@ namespace Givaro {
 		 * @param a Integers as in the formula.
 		 * @param x Integers as in the formula.
 		 */
-		static Integer& axmyin   (Integer& res,
-					  const Integer& a, const Integer& x);
-		static Integer& axmyin   (Integer& res,
-					  const Integer& a, const unsigned long x);
-		//@}
+		static giv_all_inlined  Integer& axmyin   (Integer& res,
+							   const Integer& a, const Integer& x);
+		//! @overload Integer::axmyin(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& axmyin   (Integer& res,
+							   const Integer& a, const long unsigned int x);
+		///@}
 
 		/*! @name Division/euclidean division/modulo
 		 * @brief
@@ -423,385 +989,734 @@ namespace Givaro {
 		 * (and <code>0<=r<|b|</code>).  However, one should not mix the two
 		 * conventions and expect equalities <small>(except if a>=0)</small>.
 		 */
-		//@{
+		// (FILE gmp++_int_div.C)
+		///@{
 		/*! Division \c q/=d.
 		 * @param q quotient
 		 * @param d divisor.
 		 * @return \c q
 		 */
-		static Integer& divin (Integer& q, const Integer& d);
-		static Integer& divin (Integer& q, const long d);
-		static Integer& divin (Integer& q, const unsigned long d);
+		static giv_all_inlined  Integer& divin (Integer& q, const Integer& d);
+		//! @overload Integer::divin(Integer,Integer)
+		static giv_all_inlined  Integer& divin (Integer& q, const long int d);
+		//! @overload Integer::divin(Integer,Integer)
+		static giv_all_inlined  Integer& divin (Integer& q, const long unsigned int d);
+
 		/*! Division \c q=n/d.
 		 * @param q quotient
 		 * @param n dividand.
 		 * @param d divisor
 		 * @return \c q
 		 */
-		static Integer& div   (Integer& q, const Integer& n, const Integer& d);
-		static Integer& div   (Integer& q, const Integer& n, const long d);
-		static Integer& div   (Integer& q, const Integer& n, const int d);
-		static Integer& div   (Integer& q, const Integer& n, const unsigned long d);
+		static giv_all_inlined  Integer& div   (Integer& q,
+							const Integer& n, const Integer& d);
+		//! @overload Integer::div(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& div   (Integer& q,
+							const Integer& n, const long int d);
+		//! @overload Integer::div(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& div   (Integer& q,
+							const Integer& n, const int d);
+		//! @overload Integer::div(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& div   (Integer& q,
+							const Integer& n, const long unsigned int d);
+
 		/*! Division when \c d divides \c n.
 		 * @param q exact quotient
 		 * @param n dividend
 		 * @param d divisor
 		 * @warning if quotient is not exact, the result is not predictable.
 		 */
-		static Integer& divexact  (Integer& q, const Integer& n, const Integer& d);
+		static giv_all_inlined  Integer& divexact (Integer& q,
+							   const Integer& n, const Integer& d);
 		/*! Division when \c d divides \c n.
 		 * @param n dividend
 		 * @param d divisor
 		 * @return  exact quotient \c n/d
 		 * @warning if quotient is not exact, the result is not predictable.
 		 */
-		static Integer  divexact  (const Integer& n, const Integer& d);
+		static giv_all_inlined  Integer  divexact (const Integer& n, const Integer& d);
 
 		/*! Division operator.
 		 * @param d divisor
 		 */
-		Integer  operator /  (const Integer&      d) const;
-		Integer  operator /  (const unsigned long d) const;
-		Integer  operator /  (const long          d) const;
+		giv_all_inlined Integer  operator /  (const Integer&      d) const;
+		//! @overload Integer::operator/(Integer)
+		giv_all_inlined Integer  operator /  (const long unsigned int d) const;
+		//! @overload Integer::operator/(Integer)
+		giv_all_inlined Integer  operator /  (const long int d) const;
+
 		/*! Division operator (inplace).
 		 * @param d divisor
 		 */
-		Integer& operator /= (const Integer&      d);
-		Integer& operator /= (const unsigned long d);
-		Integer& operator /= (const long          d);
+		giv_all_inlined Integer& operator /= (const Integer&      d);
+		//! @overload Integer::operator/=(Integer)
+		giv_all_inlined Integer& operator /= (const long unsigned int d);
+		//! @overload Integer::operator/=(Integer)
+		giv_all_inlined Integer& operator /= (const long int d);
+		//! @overload Integer::operator/=(Integer)
 		template<class XXX>
-		Integer& operator /=(const XXX& d) { return this->operator /= ( (Integer)d ); }
+		Integer& operator /=(const XXX& d) {
+			return this->operator /= ( (Integer)d );
+		}
+
+		//! operator /
+		friend giv_all_inlined  Integer operator / (const int l, const Integer& n);
+		//! @overload Integer::operator/(int,Integer)
+		friend giv_all_inlined  Integer operator / (const long int l,
+							    const Integer& n);
+		//! @overload Integer::operator/(int,Integer)
+		friend giv_all_inlined  Integer operator / (const Integer& n, const int l);
+		//! @overload Integer::operator/(int,Integer)
+		friend giv_all_inlined  Integer operator / (const Integer& n, const unsigned int l);
+
+		//! operator /=
+		friend giv_all_inlined  Integer& operator /= (Integer& n, const int l);
+		//! @overload Integer::operator/=(Integer,int)
+		friend giv_all_inlined  Integer& operator /= (Integer& n, const long int l);
+		//! @overload Integer::operator/=(Integer,int)
+		friend giv_all_inlined  Integer& operator /= (Integer& n, const unsigned int l);
 
 		/*!  Function \c mod (inplace).
 		 * \f$ r \gets r \mod n\f$
 		 * @param r remainder
 		 * @param n modulus
 		 */
-		static Integer& modin (Integer& r, const Integer& n);
-		static Integer& modin (Integer& r, const long n);
-		static Integer& modin (Integer& r, const unsigned long n);
+		static giv_all_inlined  Integer& modin (Integer& r, const Integer& n);
+		//! @overload Integer::modin(Integer,Integer)
+		static giv_all_inlined  Integer& modin (Integer& r, const long int n);
+		//! @overload Integer::modin(Integer,Integer)
+		static giv_all_inlined  Integer& modin (Integer& r, const long unsigned int n);
 		/*!  Function \c mod.
 		 * \f$ r \gets n \mod d\f$
 		 * @param r remainder
 		 * @param n integer
 		 * @param d modulus
 		 */
-		static Integer& mod   (Integer& r, const Integer& n, const Integer& d);
-		static Integer& mod   (Integer& r, const Integer& n, const long d);
-		static Integer& mod   (Integer& r, const Integer& n, const unsigned long d);
+		static giv_all_inlined  Integer& mod   (Integer& r,
+							const Integer& n, const Integer& d);
+		//! @overload Integer::mod(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& mod   (Integer& r,
+							const Integer& n, const long int d);
+		//! @overload Integer::mod(Integer,Integer,Integer)
+		static giv_all_inlined  Integer& mod   (Integer& r,
+							const Integer& n, const long unsigned int d);
 
 		/*! Euclidean division.
 		 * <code> n = d q + r </code>.
+		 * Computes both the quotient and the residue (as in quorem).
 		 * @param q as in the formula
 		 * @param r as in the formula
 		 * @param n as in the formula
 		 * @param d as in the formula
 		 * @return the quotient \c q
 		 */
-		static Integer& divmod   (Integer& q, Integer& r, const Integer& n, const Integer& d);
-		static Integer& divmod   (Integer& q, long& r, const Integer& n, const long d);
-		static Integer& divmod   (Integer& q, unsigned long& r, const Integer& n, const unsigned long d);
-
+		static giv_all_inlined  Integer& divmod (Integer& q,
+							 Integer& r,
+							 const Integer& n,
+							 const Integer& d);
+		//! @overload Integer::divmod(Integer,Integer,Integer,Integer)
+		static giv_all_inlined  Integer& divmod (Integer& q,
+							 long int & r,
+							 const Integer& n,
+							 const long int d);
+		//! @overload Integer::divmod(Integer,Integer,Integer,Integer)
+		static giv_all_inlined  Integer& divmod (Integer& q,
+							 long unsigned int & r,
+							 const Integer& n,
+							 const long unsigned int d);
+
+		/*! rounding functions.
+		 * these are the same as the STL ones, except for the signature.
+		 * @param res the result
+		 * @param n the numerator
+		 * @param d the demominator
+		 */
+		//! @details same as std::ceil (n/d)
+		static giv_all_inlined  Integer&   ceil (Integer & res,
+							 const Integer &n,
+							 const Integer & d);
+		//! @details same as std::floor(n/d)
+		static giv_all_inlined  Integer&   floor(Integer & res,
+							 const Integer &n,
+							 const Integer & d);
+		//! @details same as std::trunc(n/d)
+		static giv_all_inlined  Integer&   trunc(Integer & res,
+							 const Integer &n,
+							 const Integer & d);
+
+		/*! rounding functions.
+		 * these are the same as the STL ones, except for the signature.
+		 * @param n the numerator
+		 * @param d the demominator
+		 * @return n/d rounded.
+		 */
+		//! @details same as std::ceil (n/d)
+		static giv_all_inlined  Integer    ceil (const Integer &n,
+							 const Integer & d);
+		//! @details same as std::floor(n/d)
+		static giv_all_inlined  Integer    floor(const Integer &n,
+							 const Integer & d);
+		//! @details same as std::trunc(n/d)
+		static giv_all_inlined  Integer    trunc(const Integer &n,
+							 const Integer & d);
+
+		// (FILE gmp++_int_mod.C)
 		/*! Modulo operator.
 		 * @param n modulus
 		 * @return remainder <code> (*this) mod n</code>
 		 */
-		Integer  operator % (const Integer& n) const;
-		long     operator % (const unsigned long n) const;
-		long     operator % (const long n) const;
-		double   operator % (const double n) const;
-		short    operator % (const unsigned short n) const { return (short) ( this->operator % ( (unsigned long)n ) ); }
+		giv_all_inlined Integer  operator % (const Integer& n) const;
+		//! @overload Integer::operator%(Integer);
+		giv_all_inlined long     operator % (const long unsigned int n) const;
+		//! @overload Integer::operator%(Integer);
+		giv_all_inlined long     operator % (const long int n) const;
+		//! @overload Integer::operator%(Integer);
+		giv_all_inlined double   operator % (const double n) const;
+		//! @overload Integer::operator%(Integer);
+		short    operator % (const unsigned short n) const
+		{
+			return (short) ( this->operator % ( (long unsigned)n ) );
+		}
+		//! @overload Integer::operator%(Integer);
 		template<class XXX>
-		XXX      operator %(const XXX& n) const { return (XXX)this->operator % ( Integer(n) ); }
+		XXX      operator %(const XXX& n) const
+		{
+			return (XXX)this->operator % ( Integer(n) );
+		}
+
+		/** operator %
+		 * @param l
+		 * @param n
+		 * @return n%l
+		 */
+		friend giv_all_inlined  Integer operator % (const int l, const Integer& n);
+		//! @overload Integer::operator%(int,Integer);
+		friend giv_all_inlined  Integer operator % (const long int l, const Integer& n);
+		//! @overload Integer::operator%(int,Integer);
+		friend giv_all_inlined  Integer operator % (const Integer& n, const int l);
+		//! @overload Integer::operator%(int,Integer);
+		friend giv_all_inlined  Integer operator % (const Integer& n, const unsigned int l);
+		//! @overload Integer::operator%(int,Integer);
+
+		friend giv_all_inlined  Integer& operator %= (Integer& n, const int l);
+		//! @overload Integer::operator%(int,Integer);
+		friend giv_all_inlined  Integer& operator %= (Integer& n, const unsigned int l);
+
 
 		/*! Modulo operator (inplace).
 		 * @param n modulus
 		 * @return remainder <code> (*this) <- (*this) mod n</code>
 		 */
-		Integer&  operator %= (const Integer& n);
-		Integer&  operator %= (const unsigned long n);
-		Integer&  operator %= (const long n);
+		giv_all_inlined Integer&  operator %= (const Integer& n);
+		//! @overload Integer::operator%=(Integer);
+		giv_all_inlined Integer&  operator %= (const long unsigned int n);
+		//! @overload Integer::operator%=(Integer);
+		giv_all_inlined Integer&  operator %= (const long int n);
 #ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-		Integer&  operator %= (const long long n) { return *this %= (Integer)n; }
-		Integer&  operator %= (const unsigned long long n) { return *this %= (Integer)n; }
-		long long operator % (const long long n) const;
-		unsigned long long operator % (const unsigned long long n) const;
+		//! @overload Integer::operator%=(Integer);
+		Integer&  operator %= (const long long int n)
+		{
+			return *this %= (Integer)n;
+		}
+		//! @overload Integer::operator%=(Integer);
+		Integer&  operator %= (const long long unsigned int n)
+		{
+			return *this %= (Integer)n;
+		}
+		//! @overload Integer::operator%=(Integer);
+		giv_all_inlined long long operator % (const long long int n) const;
+		//! @overload Integer::operator%=(Integer);
+		giv_all_inlined long long unsigned operator % (const long long unsigned int n) const;
 #endif
+		//! @overload Integer::operator%=(Integer);
 		template<class XXX>
-		Integer& operator  %=(const XXX& n) { return this->operator %= ( (Integer)n ); }
-		//@}
+		Integer& operator  %=(const XXX& n) {
+			return this->operator %= ( (Integer)n );
+		}
+		///@}
+
+
+
+
 
 
+		// (FILE gmp++_int_gcd.C)
 		//------------------------------------- Arithmetic functions
-		/*! @name Arithmetic functions */
-		//@{
-		friend Integer gcd (const Integer& a, const Integer& b);
-		friend Integer gcd (const Integer& a, const Integer& b,
-				    Integer& u, Integer& v);
-		friend Integer& gcd (Integer& g, const Integer& a, const Integer& b);
-		friend Integer& gcd (Integer& g, const Integer& a, const Integer& b,
-				     Integer& u, Integer& v);
-		// modular inverses
-		friend Integer& inv (Integer& u, const Integer& a, const Integer& b);
-		friend Integer& invin (Integer& u, const Integer& b);
-
-		friend Integer pp( const Integer& P, const Integer& Q );
-
-		friend Integer& lcm (Integer& g, const Integer& a, const Integer& b);
-		friend Integer lcm (const Integer& a, const Integer& b);
-
-		// - return n^l
-		friend Integer& pow(Integer& Res, const Integer& n, const long l);
-		friend Integer& pow(Integer& Res, const unsigned long n, const unsigned long l);
-		friend Integer& pow(Integer& Res, const Integer& n, const unsigned long l);
-		friend Integer& pow(Integer& Res, const Integer& n, const int l) { return pow(Res, n, (long)l ); }
-		friend Integer& pow(Integer& Res, const Integer& n, const unsigned int l) { return pow(Res, n, (unsigned long)l ); }
-		friend Integer pow(const Integer& n, const long l);
-		friend Integer pow(const Integer& n, const unsigned long l);
-		friend Integer pow(const Integer& n, const int l) { return pow(n, (long)l ); }
-		friend Integer pow(const Integer& n, const unsigned int l) { return pow(n, (unsigned long)l ); }
-
-		// - return n^e % m
-		friend Integer& powmod(Integer& Res, const Integer& n, const unsigned long e, const Integer& m);
-		friend Integer& powmod(Integer& Res, const Integer& n, const long e, const Integer& m);
-		friend Integer& powmod(Integer& Res, const Integer& n, const unsigned int e, const Integer& m) { return powmod(Res, n, (unsigned long)e, m); }
-		friend Integer& powmod(Integer& Res, const Integer& n, const int e, const Integer& m)  { return powmod(Res, n, (long)e, m); }
-		friend Integer& powmod(Integer& Res, const Integer& n, const Integer& e, const Integer& m);
-		friend Integer powmod(const Integer& n, const unsigned long e, const Integer& m);
-		friend Integer powmod(const Integer& n, const long e, const Integer& m);
-		friend Integer powmod(const Integer& n, const unsigned int e, const Integer& m) { return powmod(n, (unsigned long)e, m); }
-		friend Integer powmod(const Integer& n, const int e, const Integer& m)  { return powmod(n, (long)e, m); }
-		friend Integer powmod(const Integer& n, const Integer& e, const Integer& m);
-
-		friend Integer fact ( unsigned long l);
-
-		friend Integer sqrt(const Integer& p);
-		friend Integer sqrtrem(const Integer& p, Integer& rem);
-		friend Integer& sqrt(Integer& r, const Integer& p);
-		friend Integer& sqrtrem(Integer& r, const Integer& p, Integer& rem);
-
-
-		friend bool root(Integer& q, const Integer&, unsigned int n);
-		friend long logp(const Integer& a, const Integer& p) ;
-		friend double logtwo(const Integer& a) ;
-		friend double naturallog(const Integer& a) ;
-		//@}
+		/*! @name Arithmetic functions
+		 * @{
+		 */
+		/** gcd.
+		 * @param a,b integers
+		 * @return gcd(a,b)
+		 */
+		friend giv_all_inlined  Integer gcd (const Integer& a, const Integer& b);
+		//! \overload Integer::gcd(const Integer&, const Integer&)
+		friend giv_all_inlined  Integer gcd ( Integer& u, Integer& v,
+						      const Integer& a, const Integer& b);
+		//! \overload Integer::gcd(const Integer&, const Integer&)
+		friend giv_all_inlined  Integer& gcd (Integer& g, const Integer& a, const Integer& b);
+		//! \overload Integer::gcd(const Integer&, const Integer&)
+		friend giv_all_inlined  Integer& gcd (Integer& g, Integer& u, Integer& v,
+						      const Integer& a, const Integer& b);
+
+		//! Inverse.
+		//! Compute the inverse u = a/b.
+		/*! @param u
+		 * @param a
+		 * @param b
+		 */
+		friend giv_all_inlined  Integer& inv (Integer& u, const Integer& a, const Integer& b);
+
+		//! Compute the inverse inplace  u = u/b.
+		/*! @param u
+		 * @param b
+		 */
+		friend giv_all_inlined  Integer& invin (Integer& u, const Integer& b);
+
+		//! pp
+		//! @param P,Q params
+		friend giv_all_inlined  Integer pp( const Integer& P, const Integer& Q );
+
+		//! lcm
+		//! @param g,a,b
+		//! @return g=lcm(a,b)
+		friend giv_all_inlined  Integer& lcm (Integer& g, const Integer& a, const Integer& b);
+		//! lcm
+		//! @param a,b
+		friend giv_all_inlined  Integer lcm (const Integer& a, const Integer& b);
+
+		// (FILE gmp++_int_pow.C)
+		//! pow. return \f$n^l\f$
+		//!@param Res,n,l
+		friend giv_all_inlined  Integer& pow(Integer& Res, const Integer& n, const long int l);
+		//! @overload Integer::pow(Integer,Integer,long int)
+		friend giv_all_inlined  Integer& pow(Integer& Res, const long unsigned int n, const long unsigned int l);
+		//! @overload Integer::pow(Integer,Integer,long int)
+		friend giv_all_inlined  Integer& pow(Integer& Res, const Integer& n, const long unsigned int l);
+		//! @overload Integer::pow(Integer,Integer,long int)
+		friend giv_all_inlined  Integer& pow(Integer& Res, const Integer& n, const int l)
+		{
+			return pow(Res, n, (long)l );
+		}
+		//! @overload Integer::pow(Integer,Integer,long int)
+		friend giv_all_inlined  Integer& pow(Integer& Res, const Integer& n, const unsigned int l)
+		{
+			return pow(Res, n, (long unsigned)l );
+		}
+
+		//! pow. return \f$n^l\f$
+		//!@param n,l
+		friend giv_all_inlined  Integer pow(const Integer& n, const long int l);
+		//! @overload Integer::pow(Integer,long int)
+		friend giv_all_inlined  Integer pow(const Integer& n, const long unsigned int l);
+		//! @overload Integer::pow(Integer,long int)
+		friend giv_all_inlined  Integer pow(const Integer& n, const int l)
+		{
+			return pow(n, (long)l );
+		}
+		//! @overload Integer::pow(Integer,long int)
+		friend giv_all_inlined  Integer pow(const Integer& n, const unsigned int l)
+		{
+			return pow(n, (long unsigned)l );
+		}
+		///@}
+
+		//! modular pow. return \f$n^e \mod  m\f$.
+		friend giv_all_inlined  Integer& powmod(Integer& Res, const Integer& n, const long unsigned int e, const Integer& m);
+		//! @overload Integer::powmod(Integer,Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer& powmod(Integer& Res, const Integer& n, const long int e, const Integer& m);
+		//! @overload Integer::powmod(Integer,Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer& powmod(Integer& Res, const Integer& n, const unsigned int e, const Integer& m)
+		{
+			return powmod(Res, n, (long unsigned)e, m);
+		}
+		//! @overload Integer::powmod(Integer,Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer& powmod(Integer& Res, const Integer& n, const int e, const Integer& m)
+		{
+			return powmod(Res, n, (long)e, m);
+		}
+		//! @overload Integer::powmod(Integer,Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer& powmod(Integer& Res, const Integer& n, const Integer& e, const Integer& m);
+
+
+		//! modular pow. return \f$n^e \mod  m\f$.
+		//! @param n,e,m
+		friend giv_all_inlined  Integer powmod(const Integer& n, const long unsigned int e, const Integer& m);
+		//! @overload Integer::powmod(Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer powmod(const Integer& n, const long int e, const Integer& m);
+		//! @overload Integer::powmod(Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer powmod(const Integer& n, const unsigned int e, const Integer& m)
+		{
+			return powmod(n, (long unsigned)e, m);
+		}
+		//! @overload Integer::powmod(Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer powmod(const Integer& n, const int e, const Integer& m)
+		{
+			return powmod(n, (long)e, m);
+		}
+		//! @overload Integer::powmod(Integer,long unsigned int,Integer)
+		friend giv_all_inlined  Integer powmod(const Integer& n, const Integer& e, const Integer& m);
+
+		// (FILE gmp++_int_misc.C)
+		//! fact
+		//! @param l
+		friend giv_all_inlined  Integer fact ( long unsigned int l);
+
+		//! (square) roots
+		//! @param p
+		friend giv_all_inlined  Integer sqrt(const Integer& p);
+		//! (square) roots
+		//! @param r,p
+		friend giv_all_inlined  Integer& sqrt(Integer& r, const Integer& p);
+
+		//! (square) roots
+		//! @param p,rem
+		friend giv_all_inlined  Integer sqrtrem(const Integer& p, Integer& rem);
+		//! (square) roots
+		//! @param r,p,rem
+		friend giv_all_inlined  Integer& sqrtrem(Integer& r, const Integer& p, Integer& rem);
+
+		//! (square) roots
+		//! @param q,a,n
+		friend giv_all_inlined  bool root(Integer& q,
+						  const Integer&a, unsigned int n);
+
+		//! logs
+		//! @param a,p
+		friend giv_all_inlined  long logp(const Integer& a, const Integer& p) ;
+		//! logs
+		//! @param a
+		friend giv_all_inlined  double logtwo(const Integer& a) ;
+		//! logs
+		//! @param a
+		friend giv_all_inlined  double naturallog(const Integer& a) ;
+		///@}
 
 		//-----------------------------------------Miscellaneous
 		/*! @name Miscellaneous.
 		*/
-		//@{
-		friend void swap(Integer& , Integer&);
+		///@{
+		//! swap
+		//! @param a,b
+		friend giv_all_inlined  void swap(Integer& a, Integer&b);
+
+		//! sign
+		//! @param a
+ 		friend inline int sign   (const Integer& a)
+		{
+			return a.priv_sign();
+		}
+
+		//! sign
+		int sign() const // BB is this usefull ?
+		{
+			return priv_sign();
+		} // but figure out the friend sign()
+
+		//! private sign
+		int priv_sign() const // BB no longer protected.
+		{
+			return mpz_sgn( (mpz_srcptr)&gmp_rep );
+		}
+		///@}
 
-		friend inline int sign   (const Integer& a);
-		friend inline int isZero (const Integer& a);
-		friend inline int isOne  (const Integer& a);
-		friend int isperfectpower  (const Integer& );
 
-		friend Integer abs(const Integer& n);
+		//! @name representation
+		///@{
+		//! get representation
+		mpz_ptr get_mpz()
+		{
+			return (mpz_ptr)&gmp_rep;
+		}
+
+		//! get representation (constant)
+		mpz_srcptr get_mpz_const() const
+		{
+			return (mpz_srcptr)&gmp_rep;
+		}
+
+		/*! returns the number of bytes used to store *this          */
+		//! @param a
+		friend giv_all_inlined  long unsigned int length (const Integer& a);
+
+		/*! returns the number of machine words used to store *this          */
+		giv_all_inlined size_t size() const;
+
+		/*! returns <code>ceil(log_BASE(*this))</code>.        */
+		giv_all_inlined size_t size_in_base(int B) const;
+
+		/*! returns <code>ceil(log_2(*this)) </code>.        */
+		giv_all_inlined size_t bitsize() const;
+
+		/*! return the i-th word of the integer. Word 0 is lowest word.*/
+		giv_all_inlined long unsigned operator[](size_t i) const;
+
+
+
+		// (FILE gmp++_int_misc.C)
 
-		friend Integer& prevprime(Integer&, const Integer& p);
-		friend Integer& nextprime(Integer&, const Integer& p);
-		friend int probab_prime(const Integer& p);
-		friend int probab_prime(const Integer& p, int r);
-		friend int jacobi(const Integer& u, const Integer& v) ;
-		friend int legendre(const Integer& u, const Integer& v) ;
+		//! perfect power
+		friend giv_all_inlined  int isperfectpower  (const Integer& n );
 
-		Integer& operator++() { return *this+=1UL; } // prefix
+		//! absolute value
+		friend giv_all_inlined  Integer abs(const Integer& n);
+
+		//! @name primes
+		///@{
+		friend giv_all_inlined  Integer& prevprime(Integer&, const Integer& p);
+		friend giv_all_inlined  Integer& nextprime(Integer&, const Integer& p);
+		friend giv_all_inlined  int probab_prime(const Integer& p);
+		friend giv_all_inlined  int probab_prime(const Integer& p, int r);
+		friend giv_all_inlined  int jacobi(const Integer& u, const Integer& v) ;
+		friend giv_all_inlined  int legendre(const Integer& u, const Integer& v) ;
+		///@}
+
+		//! @name Increment/Decrement operators
+		///@{
+		Integer& operator++()
+		{ // prefix
+			return *this+=1UL;
+		}
 		Integer operator++(int)
 		{ // postfix
 			Integer tmp = *this ;
 			++*this;
 			return tmp;
 		}
-		Integer& operator--() { return *this-=1UL; } // prefix
+		Integer& operator--()
+		{// prefix
+			return *this-=1UL;
+		}
 		Integer operator--(int)
 		{// postfix
 			Integer tmp = *this ;
 			--*this;
 			return tmp;
 		}
+		///@}
 
-		// - return the size in byte
-		friend inline unsigned long length (const Integer& a);
-		// - return the size in word.
-		size_t size() const;
-		// - return the size in base B (always exact if B is a power of two)
-		size_t size_in_base(int B) const;
-		// - return the size in bit.
-		size_t bitsize() const;
-		// - return the i-th word of the integer. Word 0 is lowest word.
-		unsigned long operator[](size_t i) const;
-
-		// -- Convert an Integer to a basic C++ type
-		// -- Cast operators
-		operator bool() const { return *this!=0UL; }
-		operator short() const { return (short)(int) *this; }
-		operator unsigned short() const { return (unsigned short) (unsigned int) *this; }
-		operator unsigned char() const { return (unsigned char) (unsigned int) *this; }
-		operator unsigned int() const ;
-		operator int() const ;
-		operator signed char() const { return (signed char) (int) *this; }
-		operator unsigned long() const ;
-		operator long() const ;
+
+		/** @name Cast operators.
+		 * Convert an Integer to a basic C++ type.
+		 * @warning Cast towards \b unsigned consider only the absolute
+		 * value
+		 */
+		///@{
+		operator bool() const
+		{
+			return *this!=0UL;
+		}
+		operator short() const
+		{
+			return (short)(int) *this;
+		}
+		operator unsigned short() const
+		{
+			return (unsigned short) (unsigned int) *this;
+		}
+		operator unsigned char() const
+		{
+			return (unsigned char) (unsigned int) *this;
+		}
+		giv_all_inlined operator unsigned int() const ;
+		giv_all_inlined operator int() const ;
+		operator signed char() const
+		{
+			return (signed char) (int) *this;
+		}
+		giv_all_inlined operator long unsigned() const ;
+		giv_all_inlined operator long() const ;
 #ifndef __GIVARO__DONOTUSE_longlong__
-		operator unsigned long long() const ;
-		operator long long() const ;
+		giv_all_inlined operator long long unsigned() const ;
+		giv_all_inlined operator long long() const ;
 #endif
-		operator std::string() const ;
-		operator float() const ;
-		operator double() const ;
-		operator vect_t() const ;
-		//@}
-
+		giv_all_inlined operator std::string() const ;
+		giv_all_inlined operator float() const ;
+		giv_all_inlined operator double() const ;
+		giv_all_inlined operator vect_t() const ;
+		///@}
+
+		// (FILE gmp++_int_rand.inl)
+		/* BB:
+		 * if the following functions are NOT static inline, one
+		 * can use -Wl,-zmuldefs....
+		 */
 		//--------------------Random Iterators
 		/*! @name Random numbers functions
 		*/
-		//@{
-		static void seeding(unsigned long int  s);
-		static void seeding(Integer s);
-		static void seeding();
+		//! Random numbers (no doc)
+		///@{
+		static inline void seeding(long unsigned int  s);
+		static inline void seeding(Integer s);
+		static inline void seeding();
 
 #ifdef __GMP_PLUSPLUS__
-		static gmp_randclass& randstate();
+		static inline gmp_randclass& randstate();
 #else
-		static __gmp_randstate_struct intializerandstate();
-		static __gmp_randstate_struct* randstate();
+		// static __gmp_randstate_struct initializerandstate();
+		// static __gmp_randstate_struct* randstate();
 #endif
-		static bool RandBool()  ;
+		static inline bool RandBool()  ;
 		/*  random <= */
-		template<bool U>
-		static Integer& random_lessthan (Integer& r, const Integer & m);
-		static Integer& random_lessthan (Integer& r, const Integer & m)
-		{return random_lessthan<true>(r,m);}
-		template<bool U>
-		static Integer& random_lessthan_2exp (Integer& r, const unsigned long & m);
-		static Integer& random_lessthan_2exp (Integer& r, const unsigned long & m)
-		{ return random_lessthan_2exp<true>(r,m);}
-		template<bool U>
-		static Integer random_lessthan_2exp (const unsigned long & m);
-		static Integer random_lessthan_2exp (const unsigned long & m)
-		{ return random_lessthan_2exp<true>(m);}
-		template<bool U>
-		static Integer& random_lessthan (Integer& r, const unsigned long & m) ;
-		static Integer& random_lessthan (Integer& r, const unsigned long & m)
-		{ return random_lessthan<true>(r,m);}
-		template<bool U,class T>
-		static Integer random_lessthan (const T & m);
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_lessthan (Integer& r, const Integer & m);
+		static inline Integer& random_lessthan (Integer& r, const Integer & m) ;
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_lessthan_2exp (Integer& r, const long unsigned int & m);
+
+		static inline Integer& random_lessthan_2exp (Integer& r, const long unsigned int & m) ;
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer random_lessthan_2exp (const long unsigned int & m);
+		static inline Integer random_lessthan_2exp (const long unsigned int & m) ;
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_lessthan (Integer& r, const long unsigned int & m) ;
+
+		static inline Integer& random_lessthan (Integer& r, const long unsigned int & m) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer random_lessthan (const T & m);
 		template<class T>
-		static Integer random_lessthan (const T & m)
-		{ return random_lessthan<true>(m);}
+		static inline Integer random_lessthan (const T & m) ;
 
 
 		/*  random = */
-		template<bool U>
-		static Integer& random_exact (Integer& r, const Integer & s) ;
-		static Integer& random_exact (Integer& r, const Integer & s)
-		{ return random_exact<true>(r,s); }
-		template<bool U>
-		static Integer& random_exact_2exp (Integer& r, const unsigned long int & m) ;
-		static Integer& random_exact_2exp (Integer& r, const unsigned long int & m)
-		{return random_exact_2exp<true>(r,m);}
-		template<bool U>
-		static Integer& random_exact (Integer& r, const unsigned long int & m)  ;
-		static Integer& random_exact (Integer& r, const unsigned long int & m)
-		{return random_exact<true>(r,m);}
-		template<bool U,class T>
-		static Integer& random_exact (Integer& r, const T & m)
-		{ return random_exact<U>(r,static_cast<unsigned long int>(m)); }
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_exact_2exp (Integer& r, const long unsigned int & m) ;
+		static inline Integer& random_exact_2exp (Integer& r, const long unsigned int & m);
+
+
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_exact (Integer& r, const Integer & s) ;
+		static inline Integer& random_exact (Integer& r, const Integer & s) ;
+
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer& random_exact (Integer& r, const long unsigned int & m)  ;
+		static inline Integer& random_exact (Integer& r, const long unsigned int & m) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer& random_exact (Integer& r, const T & m) ;
 		template<class T>
-		static Integer& random_exact (Integer& r, const T & m)
-		{ return random_exact(r,static_cast<unsigned long int>(m)); }
-		template<bool U,class T>
-		static Integer random_exact (const T & s) ;
+		static inline Integer& random_exact (Integer& r, const T & m) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer random_exact (const T & s) ;
 		template<class T>
-		static Integer random_exact (const T & s)
-		{ return random_exact<true>(s) ; }
+		static inline Integer random_exact (const T & s) ;
 
 		/*  random <.< */
-		static Integer& random_between (Integer& r, const Integer& m, const Integer&M) ;
-		static Integer random_between (const Integer& m, const Integer &M) ;
-		static Integer& random_between_2exp (Integer& r, const unsigned long int& m, const unsigned long int &M) ;
-		static Integer& random_between (Integer& r, const unsigned long int& m, const unsigned long int &M) ;
-		static Integer random_between_2exp (const unsigned long int & m, const unsigned long int &M) ;
-		static Integer random_between (const unsigned long int & m, const unsigned long int &M) ;
-
+		static inline Integer& random_between (Integer& r, const Integer& m, const Integer&M) ;
+		static inline Integer random_between (const Integer& m, const Integer &M) ;
+		static inline Integer& random_between_2exp (Integer& r, const long unsigned int& m,
+							    const long unsigned int &M) ;
+		static inline Integer& random_between (Integer& r, const long unsigned int& m,
+						       const long unsigned int &M) ;
+		static inline Integer random_between_2exp (const long unsigned int & m,
+							   const long unsigned int &M) ;
+		static inline Integer random_between (const long unsigned int & m,
+						      const long unsigned int &M) ;
 		template<class R>
-		static Integer random_between (const R & m, const R & M)
-		{ return random_between(static_cast<unsigned long int>(m), static_cast<unsigned long int>(M)); }
-
+		static inline Integer random_between (const R & m, const R & M) ;
 		template<class R>
-		static Integer & random_between (Integer &r, const R & m, const R & M)
-		{ return random_between(r,static_cast<unsigned long int>(m), static_cast<unsigned long int>(M)); }
+		static inline Integer & random_between (Integer &r, const R & m, const R & M);
 
 
 		// useful functions :
-		template<bool U,class T>
-		static Integer& random (Integer& r, const T & m) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer& random (Integer& r, const T & m) ;
 		template<class T>
-		static Integer& random (Integer& r, const T & m)
-		{return random<true>(r,m);}
-		template<bool U,class T>
-		static Integer random(const T & sz) ;
+		static inline Integer& random (Integer& r, const T & m) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer random(const T & sz) ;
 		template<class T>
-		static Integer random(const T & sz)
-		{ return random<true>(sz);}
-		template<bool U>
-		static Integer random();
-		static Integer random();
-		template<bool U,class T>
-		static Integer nonzerorandom(const T & sz) ;
-		template<bool U,class T>
-		static Integer& nonzerorandom (Integer& r, const T& size) ;
+		static inline Integer random(const T & sz) ;
+		template<bool ALWAYSPOSITIVE>
+		static inline Integer random();
+		static inline Integer random();
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer nonzerorandom(const T & sz) ;
+		template<bool ALWAYSPOSITIVE,class T>
+		static inline Integer& nonzerorandom (Integer& r, const T& size) ;
 		template<class T>
-		static Integer nonzerorandom(const T & sz)
-		{ return nonzerorandom<true>(sz); }
+		static inline Integer nonzerorandom(const T & sz) ;
 		template<class T>
-		static Integer& nonzerorandom (Integer& r, const T& size)
-		{ return nonzerorandom<true>(r,size); }
-		static Integer nonzerorandom()
-		{
-			Integer rez = Integer::nonzerorandom(sizeof(mp_limb_t)*8) ;
-			// if (!U) if (Integer::RandBool()) negin(rez);
-			return rez;
-		}
-		//@}
+		static inline Integer& nonzerorandom (Integer& r, const T& size) ;
+		static inline Integer nonzerorandom() ;
+		///@}
 
 		//----------------------------------------------I/O
-		/*! @name I/O
-		*/
-		//@{
-		friend std::istream& operator >> (std::istream &i, Integer& n);
-		friend std::ostream& operator << (std::ostream &o, const Integer& n);
-		friend std::ostream& absOutput (std::ostream &o, const Integer& n);
+		/*! @name I/O */
+		//! Input/Output of Integers
+		///@{
 
-		friend void importWords(Integer&, size_t, int, int, int, size_t, const void*);
-
-		std::ostream& print( std::ostream& o ) const;
-		//@}
+		/** in operator.
+		 * @param i input stream
+		 * @param n integer to be built
+		 */
+		friend giv_all_inlined  std::istream& operator >> (std::istream &i, Integer& n);
 
-		int sign() const {return priv_sign(); } // but figure out the friend sign()
+		/** @brief out operator.
+		 * @param o output stream
+		 * @param n integer to be printed
+		 */
+		friend giv_all_inlined  std::ostream& operator << (std::ostream &o, const Integer& n);
+
+		//! nodoc
+		//! @param o output
+		//! @param n integer
+		friend giv_all_inlined  std::ostream& absOutput (std::ostream &o, const Integer& n);
+
+		/// nodoc
+		/*! @param  x x
+		 * @param count x
+		 * @param order x
+		 * @param size x
+		 * @param endian x
+		 * @param nails x
+		 * @param op x
+		 */
+		friend giv_all_inlined  void importWords(Integer& x , size_t count, int order,
+							 int size, int endian, size_t nails,
+							 const void* op);
+		/** print integer.
+		 * @param o output stream.
+		 */
+		giv_all_inlined std::ostream& print( std::ostream& o ) const;
+		///@}
 
-		mpz_ptr get_mpz() {return (mpz_ptr)&gmp_rep;}
 
 	protected:
 
-		typedef __mpz_struct Rep;
+		typedef __mpz_struct Rep; //!< @internal rep type
+
+		Rep gmp_rep;//!< @internal rep
 
-		Rep gmp_rep;
+		//mpz_ptr get_mpz()
+		//{ return (mpz_ptr)&gmp_rep; }
 
-		int priv_sign() const;
-		//mpz_ptr get_mpz() {return (mpz_ptr)&gmp_rep;}
-		const Rep* get_rep() const { return &gmp_rep; }
+		//!@internal get representation.
+		const Rep* get_rep() const
+		{
+			return &gmp_rep;
+		}
 
-		// -- Creates a new Integer from a size sz and a array of unsigned long d
-		Integer(unsigned long* d, long size);
 
 	}; //----------------------------------------------- End of Class Integer
 
+	//! generic sign
+	template<class T>
+	static inline int sign (const T a)
+	{
+		// std::cout << ((a>0)-(a<0)) << std::endl;
+		return (a>0)-(a<0);
+		// if (a == 0) return 0 ;
+		// return (a<0)?-1:1 ;
+	}
+
+
 } // Givaro
 
-#include "gmp++/gmp++_int.inl"
+// only template code is inlined
+#ifdef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++_int.C"
+#endif
+#include "gmp++/gmp++_int_rand.inl"
 
 #endif // __GIVARO_GMPplusplus_integer_H
 
diff --git a/src/kernel/gmp++/gmp++_int.inl b/src/kernel/gmp++/gmp++_int.inl
deleted file mode 100644
index 012f6ba..0000000
--- a/src/kernel/gmp++/gmp++_int.inl
+++ /dev/null
@@ -1,884 +0,0 @@
-// ========================================================================
-// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int.inl,v $
-// Copyright(c)'1994-2010 by The Givaro group
-// This file is part of Givaro.
-// Givaro is governed by the CeCILL-B license under French law
-// and abiding by the rules of distribution of free software.
-// see the COPYRIGHT file for more details.
-// Authors: M. Samama, T. Gautier
-// Modified by: B. Boyer
-// $Id: gmp++_int.inl,v 1.20 2011-02-02 16:23:55 bboyer Exp $
-// ========================================================================
-// Description:
-//
-
-#ifndef __GIVARO_gmpxx_integer_INL
-#define __GIVARO_gmpxx_integer_INL
-
-#define GMP__ABS(l)     ((l) <0 ? -l : l)
-#define GMP__SGN(l)    ((l) <0 ? -1 : (l >0 ? 1 : 0))
-
-#include <cassert>
-#include <givaro/givtimer.h>
-
-namespace Givaro {
-
-	//-----------------------------~Integer()
-	inline Integer::~Integer() {  mpz_clear((mpz_ptr)&gmp_rep) ;
-	}
-
-	//-------------------------------Integer(const Integer &n)
-	inline Integer::Integer(const Integer &n)
-	{
-		mpz_init_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
-	}
-
-	//------------------------------------------operator = (const Integer &n)
-	inline Integer& Integer::logcpy(const Integer &n)
-	{
-		if (this == &n) return *this;
-		mpz_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
-		return *this;
-	}
-
-	// same as logcopy
-	inline Integer& Integer::operator = (const Integer &n)
-	{
-		return logcpy(n) ;
-	}
-
-	//-----------------------------Integer(int n)
-	inline Integer::Integer(int n) { mpz_init_set_si((mpz_ptr)&gmp_rep, n) ;
-	}
-
-	//-----------------------------Integer(uint n)
-	inline Integer::Integer(unsigned char n) { mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
-	}
-
-	//-----------------------------Integer(uint n)
-	inline Integer::Integer(unsigned int n) { mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
-	}
-
-	//-----------------------------Integer(long n)
-	inline Integer::Integer(long n) { mpz_init_set_si((mpz_ptr)&gmp_rep, n) ;
-	}
-
-	//-----------------------------Integer(unsigned long n)
-	inline Integer::Integer(unsigned long n) { mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
-	}
-
-#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-#include <stdio.h>
-	//-----------------------------Integer(long long n)
-	// log[10](2^8) < 2.408239966
-	inline Integer::Integer(long long n)
-	{
-		char * tmp = new char[long(2.408239966*sizeof(long long))+1]; sprintf(tmp,"%lld",n);
-		mpz_init_set_str((mpz_ptr)&gmp_rep, tmp, 10) ;
-		delete [] tmp;
-	}
-
-	//-----------------------------Integer(unsigned long long n)
-	// log[10](2^8) < 2.408239966
-	inline Integer::Integer(unsigned long long n)
-	{
-		char * tmp = new char[ long(2.408239966*sizeof(unsigned long long))+1];
-		sprintf(tmp,"%llu",n);
-		mpz_init_set_str((mpz_ptr)&gmp_rep, tmp, 10) ;
-		delete [] tmp;
-	}
-#endif
-
-
-	//-----------------------------Integer(double)
-	inline Integer::Integer(double d) { mpz_init_set_d((mpz_ptr)&gmp_rep, d) ;
-	}
-
-
-	//-----------------------------Integer(const neutral n), default n = zero
-	/* Neutral is causing a problem
-	   inline Integer::Integer(const Neutral n)
-	   {
-	   if (n == Neutral::zero) mpz_init_set_ui((mpz_ptr)&gmp_rep, 0L) ;
-	   else  mpz_init_set_ui((mpz_ptr)&gmp_rep, 1L) ;
-	   }
-	   */
-
-	//-------------------------------------------------inline comparaison operators
-	inline int operator != (const Integer& a , const Integer& b)
-	{
-		return compare(a,b) != 0;
-	}
-
-	inline int operator != (int l, const Integer& n)
-	{
-		return n.operator != (l);
-	}
-
-	inline int operator != (long l, const Integer& n)
-	{
-		return n.operator != (l);
-	}
-
-	inline int operator != (unsigned long l, const Integer& n)
-	{
-		return n.operator != (l);
-	}
-
-	inline int operator == (const Integer& a, const Integer& b)
-	{
-		return compare(a,b) == 0;
-	}
-
-	inline int operator == (int l, const Integer& n)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator == (long l, const Integer& n)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator == (unsigned long l, const Integer& n)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator == (const Integer& n, unsigned long l)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator == (const Integer& n, int l)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator == (const Integer& n, long l)
-	{
-		return (! (n.operator != (l)));
-	}
-
-	inline int operator < (const Integer& a , const Integer& b)
-	{
-		return compare(a,b) < 0;
-	}
-
-	inline int operator < (const int l, const Integer& n)
-	{
-		return n > l;
-	}
-
-	inline int operator < (const long l, const Integer& n)
-	{
-		return n > l;
-	}
-
-	inline int operator < (const unsigned long l, const Integer& n)
-	{
-		return n > l;
-	}
-
-	inline int operator <= (const Integer& n, unsigned long l)
-	{
-		return (! (n > l) );
-	}
-
-	inline int operator <= (unsigned long l, const Integer& n)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator >= (unsigned long l, const Integer& n)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator >= (const Integer& n, unsigned long l)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator > (int l, const Integer& n)
-	{
-		return n < l;
-	}
-
-	inline int operator > (long l, const Integer& n)
-	{
-		return n < l;
-	}
-
-	inline int operator > (unsigned long l, const Integer& n)
-	{
-		return n < l;
-	}
-
-	inline int operator >  (const Integer& a , const Integer& b)
-	{
-		return compare(a,b) > 0;
-	}
-
-	inline int operator <= (const Integer& a, const Integer& b)
-	{
-		return compare(a,b) <= 0;
-	}
-
-	inline int operator <= (const Integer& n, int l)
-	{
-		return (! (n > l) );
-	}
-
-	inline int operator <= (const Integer& n, long l)
-	{
-		return (! (n > l) );
-	}
-
-	inline int operator <= (int l, const Integer& n)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator <= (long l, const Integer& n)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator >= (const Integer& a, const Integer& b)
-	{
-		return compare(a,b) >= 0;
-	}
-
-	inline int operator >= (int l, const Integer& n)
-	{
-		return (! (n > l) );
-	}
-
-	inline int operator >= (long l, const Integer& n)
-	{
-		return (! (n > l) );
-	}
-
-	inline int operator >= (const Integer& n, int l)
-	{
-		return (! (n < l) );
-	}
-
-	inline int operator >= (const Integer& n, long l)
-	{
-		return (! (n < l) );
-	}
-
-
-	//----------------------------------arithmetic inline operators
-	inline Integer Integer::operator - () const
-	{
-		// JGD 18.06.1999
-		Integer Res ;
-		mpz_neg((mpz_ptr)&Res.gmp_rep, (mpz_srcptr)&gmp_rep );
-		return Res ;
-	}
-
-	// -- operator +
-	inline Integer operator + (const int l, const Integer& n)
-	{
-		return n + (long)l;
-	}
-	inline Integer operator + (const unsigned int l, const Integer& n)
-	{
-		return n + (unsigned long)l;
-	}
-	inline Integer operator + (const long l, const Integer& n)
-	{
-		return n + l;
-	}
-	inline Integer operator + (const unsigned long l, const Integer& n)
-	{
-		return n + l;
-	}
-	inline Integer operator + (const Integer& n, const int l)
-	{
-		return n + (long)l;
-	}
-	inline Integer operator + (const Integer& n, const unsigned int l)
-	{
-		return n + (unsigned long)l;
-	}
-
-	inline Integer& operator += (Integer& n, const int l)
-	{
-		return n += (long)l;
-	}
-	inline Integer& operator += (Integer& n, const unsigned int l)
-	{
-		return n += (unsigned long)l;
-	}
-
-#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-	inline Integer operator + (const Integer& n, const long long l)
-	{
-		return n + (Integer)l;
-	}
-	inline Integer operator + (const Integer& n, const unsigned long long l)
-	{
-		return n + (Integer)l;
-	}
-	inline Integer operator + (const long long l, const Integer& n)
-	{
-		return n+l;
-	}
-	inline Integer operator + (const unsigned long long l, const Integer& n)
-	{
-		return n+l;
-	}
-	inline Integer& operator += (Integer& n, const long long l)
-	{
-		return n += (Integer)l;
-	}
-	inline Integer& operator += (Integer& n, const unsigned long long l)
-	{
-		return n += (Integer)l;
-	}
-#endif
-
-
-	// -- operator -
-	inline Integer operator - (const int l, const Integer& n)
-	{
-		return -(n - (long)l);
-	}
-	inline Integer operator - (const unsigned int l, const Integer& n)
-	{
-		return -(n - (unsigned long)l);
-	}
-	inline Integer operator - (const long l, const Integer& n)
-	{
-		return -(n - l);
-	}
-	inline Integer operator - (const unsigned long l, const Integer& n)
-	{
-		return -(n - l);
-	}
-	inline Integer operator - (const Integer& n, const int l)
-	{
-		return n - (long)l;
-	}
-	inline Integer operator - (const Integer& n, const unsigned int l)
-	{
-		return n - (unsigned long)l;
-	}
-
-	inline Integer& operator -= (Integer& n, const int l)
-	{
-		return n -= (long)l;
-	}
-	inline Integer& operator -= (Integer& n, const unsigned int l)
-	{
-		return n -= (unsigned long)l;
-	}
-
-#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-	inline Integer operator - (const Integer& n, const long long l)
-	{
-		return n - (Integer)l;
-	}
-	inline Integer operator - (const Integer& n, const unsigned long long l)
-	{
-		return n - (Integer)l;
-	}
-	inline Integer operator - (const long long l, const Integer& n)
-	{
-		return n-l;
-	}
-	inline Integer operator - (const unsigned long long l, const Integer& n)
-	{
-		return n-l;
-	}
-	inline Integer& operator -= (Integer& n, const long long l)
-	{
-		return n -= (Integer)l;
-	}
-	inline Integer& operator -= (Integer& n, const unsigned long long l)
-	{
-		return n -= (Integer)l;
-	}
-#endif
-
-	// -- operator *
-	inline Integer operator * (const int l, const Integer& n)
-	{
-		return n * (long)l;
-	}
-	inline Integer operator * (const unsigned int l, const Integer& n)
-	{
-		return n * (unsigned long)l;
-	}
-	inline Integer operator * (const long l, const Integer& n)
-	{
-		return n * l;
-	}
-	inline Integer operator * (const unsigned long l, const Integer& n)
-	{
-		return n * l;
-	}
-	inline Integer operator * (const Integer& n, const int l)
-	{
-		return n * (long)l;
-	}
-	inline Integer operator * (const Integer& n, const unsigned int l)
-	{
-		return n * (unsigned long)l;
-	}
-
-	inline Integer& operator *= (Integer& n, const int l)
-	{
-		return n *= (long)l;
-	}
-	inline Integer& operator *= (Integer& n, const unsigned int l)
-	{
-		return n *= (unsigned long)l;
-	}
-
-#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-	inline Integer operator * (const Integer& n, const long long l)
-	{
-		return n * (Integer)l;
-	}
-	inline Integer operator * (const Integer& n, const unsigned long long l)
-	{
-		return n * (Integer)l;
-	}
-	inline Integer operator * (const long long l, const Integer& n)
-	{
-		return n*l;
-	}
-	inline Integer operator * (const unsigned long long l, const Integer& n)
-	{
-		return n*l;
-	}
-	inline Integer& operator *= (Integer& n, const long long l)
-	{
-		return n *= (Integer)l;
-	}
-	inline Integer& operator *= (Integer& n, const unsigned long long l)
-	{
-		return n *= (Integer)l;
-	}
-#endif
-
-	// -- operator /
-	inline Integer operator / (const int l, const Integer& n)
-	{
-		return Integer(l)/n;
-	}
-	inline Integer operator / (const long l, const Integer& n)
-	{
-		return Integer(l)/n;
-	}
-	inline Integer operator / (const Integer& n, const int l)
-	{
-		return n / (long)l;
-	}
-	inline Integer operator / (const Integer& n, const unsigned int l)
-	{
-		return n / (unsigned long)l;
-	}
-
-	inline Integer& operator /= (Integer& n, const int l)
-	{
-		if (l>=0)
-			return n /= (unsigned long)l;
-		else
-			return  n = -(n / (unsigned long)-l);
-	}
-	inline Integer& operator /= (Integer& n, const long l)
-	{
-		return n /= (unsigned long)l;
-	}
-	inline Integer& operator /= (Integer& n, const unsigned int l)
-	{
-		return n /= (unsigned long)l;
-	}
-
-	// -- operator %
-	inline Integer operator % (const int l, const Integer& n)
-	{
-		return Integer(l) % n;
-	}
-	inline Integer operator % (const long l, const Integer& n)
-	{
-		return Integer(l) % n;
-	}
-	inline Integer operator % (const Integer& n, const int l)
-	{
-		return n % (long)l;
-	}
-	inline Integer operator % (const Integer& n, const unsigned int l)
-	{
-		return n % (unsigned long)l;
-	}
-
-	inline Integer& operator %= (Integer& n, const int l)
-	{
-		return n %= (long)l;
-	}
-	inline Integer& operator %= (Integer& n, const unsigned int l)
-	{
-		return n %= (unsigned long)l;
-	}
-
-
-	//----------miscellaneous inline functions
-
-	inline int Integer::priv_sign() const
-	{
-		return mpz_sgn( (mpz_srcptr)&gmp_rep );
-	}
-
-	inline int isOne(const Integer& a)
-	{
-		return ! mpz_cmp_ui((mpz_srcptr)&(a.gmp_rep), 1UL);
-	}
-
-	inline int isZero(const Integer& a)
-	{
-		return ! mpz_cmp_ui((mpz_srcptr)&(a.gmp_rep), 0UL);
-	}
-
-	inline int isZero(const short int a)
-	{
-		return a ==0;
-	}
-	inline int isZero(const int a)
-	{
-		return a ==0;
-	}
-	inline int isZero(const long a)
-	{
-		return a ==0;
-	}
-	inline int isZero(const unsigned short int a)
-	{
-		return a ==0;
-	}
-	inline int isZero(const unsigned int a)
-	{
-		return a ==0;
-	}
-	inline int isZero(const unsigned long a)
-	{
-		return a ==0UL;
-	}
-#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
-#if 1 /*  use of C++0x long long integer constant */
-	inline int isZero(const unsigned long long a)
-	{
-		return a ==0ULL;
-	}
-#endif
-	inline int isZero(const long long a)
-	{
-		return a ==0LL;
-	}
-#endif
-
-	inline int sign(const Integer& a)
-	{
-		return a.priv_sign();
-	}
-
-	inline unsigned long length(const Integer& a)
-	{
-		return mpz_size( (mpz_srcptr)&(a.gmp_rep) ) * sizeof(unsigned long);
-	}
-
-	inline Integer abs(const Integer &n) { if (sign(n) >= 0) return n; return -n;
-	}
-
-	inline size_t Integer::size() const
-	{
-		return  mpz_size( (mpz_srcptr)&gmp_rep ) ;
-	}
-
-	inline size_t Integer::size_in_base(int BASE) const
-	{
-		return  mpz_sizeinbase ((mpz_srcptr)&gmp_rep, BASE);
-	}
-
-	inline size_t Integer::bitsize() const
-	{
-		return  mpz_sizeinbase ((mpz_srcptr)&gmp_rep, 2);
-	}
-
-	inline unsigned long Integer::operator[](size_t i) const
-	{
-		if ( mpz_size( (mpz_srcptr)&gmp_rep ) > i)
-			return mpz_getlimbn( (mpz_srcptr)&gmp_rep, i);
-		else
-			return 0;
-	}
-
-	//-------------------------------------------------inline >> & << operators
-	inline std::ostream& operator<< (std::ostream& o, const Integer& a)
-	{
-		return a.print(o);
-	}
-
-	//-----------------------------------------------------
-	//----------------------- Random integers -------------
-	//-----------------------------------------------------
-
-	/* ********************** */
-	/* seeding, initialising  */
-	/* ********************** */
-	inline gmp_randclass& Integer::randstate()
-	{
-		static gmp_randclass randstate(gmp_randinit_default);
-		return static_cast<gmp_randclass&>(randstate);
-	}
-
-	inline void Integer::seeding(unsigned long  s)
-	{
-		Integer::randstate().seed(s) ;
-	}
-
-	inline void Integer::seeding(Integer  s)
-	{
-		Integer::randstate().seed((mpz_class) (mpz_srcptr) &(s.gmp_rep) ) ;
-	}
-
-	inline void Integer::seeding()
-	{
-		Integer::seeding( BaseTimer::seed() );
-	}
-
-
-	// BB : good seeding but not so efficient...
-	inline bool Integer::RandBool()
-	{
-		if (Integer::random(1UL)) return true;
-		else return false ;
-	}
-
-
-	/* ****************************** */
-	/*  random number smaller than m  */
-	/* ****************************** */
-
-#ifdef __GMP_PLUSPLUS__
-	//! returns a random integer \p r in the intervall <code>[[0, m-1]]</code>
-	template<bool U>
-	inline Integer& Integer::random_lessthan (Integer& r, const Integer & m)
-	{
-		mpz_set( (mpz_ptr) &(r.gmp_rep) ,
-			 ( (mpz_class)Integer::randstate().get_z_range((mpz_class) (mpz_srcptr) &(m.gmp_rep)) ).get_mpz_t() );
-		if(!U) if (Integer::RandBool()) Integer::negin(r);
-		return r;
-	}
-#else
-	//! returns a random integer \p r in the intervall <code>[[0, m-1]]</code>
-	template<bool U>
-	inline Integer& Integer::random_lessthan (Integer& r, const Integer & m)
-	{
-		mpz_urandomm((mpz_ptr) &(r.gmp_rep),Integer::randstate(),(mpz_srcptr)&(m.gmp_rep));
-		if(!U) if (Integer::RandBool()) Integer::negin(r);
-		return r;
-	}
-#endif
-
-	/* ******************************** */
-	/*  random number smaller than 2^m  */
-	/* ******************************** */
-
-#ifdef __GMP_PLUSPLUS__
-	//! returns a random integer \p r of at most \p m bits
-	template<bool U>
-	inline Integer& Integer::random_lessthan_2exp (Integer& r, const unsigned long & m)
-	{
-		mpz_set( (mpz_ptr) &(r.gmp_rep) , ((mpz_class)Integer::randstate().get_z_bits(m)).get_mpz_t() );
-		if(!U) {if (Integer::RandBool()) Integer::negin(r);
-		}
-		return r;
-	}
-#else
-	//! returns a random integer \p r of at most \p m bits
-	template<bool U>
-	inline Integer& Integer::random_lessthan_2exp (Integer& r, const unsigned long & m)
-	{
-		mpz_urandomb((mpz_ptr) &(r.gmp_rep),Integer::randstate(),m) ;
-		if(!U) if (Integer::RandBool()) Integer::negin(r);
-		return r;
-	}
-#endif
-
-	template<bool U>
-	inline Integer Integer::random_lessthan_2exp (const unsigned long & m)
-	{
-		Integer r ;
-		random_lessthan_2exp<U>(r,m);
-		return r;
-	}
-
-	/* synonyms */
-	template<bool U>
-	inline Integer& Integer::random_lessthan (Integer& r, const unsigned long & m)
-	{
-		return Integer::random_lessthan_2exp<U>(r,m);
-	}
-
-	template<bool U,class T>
-	inline Integer Integer::random_lessthan (const T & m)
-	{
-		Integer res ;
-		return random_lessthan<U>(res,m);
-	}
-
-	/* ********************************* */
-	/*  random number of same size as s  */
-	/* ********************************* */
-
-	//! returns a reference to a random number \p r of the size of \p s, exactly.
-	template<bool U>
-	inline Integer& Integer::random_exact (Integer& r, const Integer & s)
-	{
-		size_t t = s.bitsize() ;
-		random_exact_2exp<U>(r,t);
-		return r;
-	}
-
-
-	/* ************************* */
-	/*  random number of size m  */
-	/* ************************* */
-
-	//! returns a reference to a random number \p r of the size \p m bits, exactly.
-	template<bool U>
-	inline Integer& Integer::random_exact_2exp (Integer& r, const unsigned long int & m)
-	{
-		if (m) random_lessthan_2exp<true>(r,m-1);
-		mpz_setbit( (mpz_ptr) &(r.gmp_rep) , m-1);
-		if(!U) if (Integer::RandBool()) Integer::negin(r);
-		return r;
-	}
-
-	// synonym
-	template<bool U>
-	inline Integer& Integer::random_exact (Integer& r, const unsigned long int & m)
-	{
-		return Integer::random_exact_2exp<U>(r,m) ;
-	}
-
-	template<bool U,class T>
-	inline Integer Integer::random_exact (const T & s)
-	{
-		Integer res ;
-		return random_exact<U>(res,s);
-	}
-
-	/* **************************** */
-	/*  random number in [[m,M-1]]  */
-	/* **************************** */
-
-	inline Integer& Integer::random_between (Integer& r, const Integer& m, const Integer&M)
-	{
-		assert(M > m);
-		random_lessthan(r,Integer(M-m));
-		r += m ;
-		return (r);
-	}
-
-	inline Integer Integer::random_between (const Integer& m, const Integer &M)
-	{
-		Integer r ;
-		return random_between(r,m,M);
-	}
-
-	/* ******************************** */
-	/*  random number in [[2^m,2^M-1]]  */
-	/* ******************************** */
-	// todo : template<bool U, bool V>
-	inline Integer& Integer::random_between_2exp (Integer& r, const unsigned long int& m, const unsigned long int &M)
-	{
-		assert(M > m);
-		r = nonzerorandom((unsigned long int)M-m);
-		Integer r1 = random_lessthan_2exp(m);
-		r <<= m ;
-		r+= r1 ;
-		return (r);
-	}
-
-	inline Integer Integer::random_between_2exp (const unsigned long int & m, const unsigned long int &M)
-	{
-		Integer r ;
-		return random_between_2exp(r,m,M);
-	}
-
-	// synonym.
-	inline Integer Integer::random_between (const unsigned long & m, const unsigned long &M)
-	{
-		return random_between_2exp(m,M) ;
-	}
-
-
-	inline Integer& Integer::random_between (Integer& r, const unsigned long int& m, const unsigned long int &M)
-	{
-		return random_between_2exp(r,m,M);
-	}
-	/* **************/
-	/*  short hand  */
-	/* **************/
-
-	//! returns a random integer less than...
-	template<bool U,class T>
-	inline Integer& Integer::random (Integer& r, const T & m)
-	{
-		return Integer::random_lessthan<U>(r,m) ;
-	}
-
-	//! returns a random integer less than...
-	template<bool U,class T>
-	inline Integer Integer::random(const T & sz)
-	{
-		return Integer::random_lessthan<U,T>(sz);
-	}
-
-	inline Integer Integer::random()
-	{
-		return Integer::random(sizeof(mp_limb_t)*8) ;
-	}
-	template<bool U>
-	inline Integer Integer::random()
-	{
-		Integer rez = Integer::random(sizeof(mp_limb_t)*8) ;
-		if (!U) if (Integer::RandBool()) negin(rez);
-		return rez;
-	}
-
-	/* *******************/
-	/*  Non Zero random  */
-	/* *******************/
-
-	template<bool U, class T>
-	inline Integer Integer::nonzerorandom(const T & sz)
-	{
-		Integer r;
-		while(isZero(Integer::random<U,T>(r, sz) )) {} ;
-		return r;
-	}
-
-	// BB: It's also 1+random(sz-1)...
-
-	template<bool U, class T>
-	inline Integer& Integer::nonzerorandom (Integer& r, const T& size)
-	{
-		while (isZero(Integer::random<U,T>(r,size))) {} ;
-		return r;
-	}
-
-}
-
-#endif // __GIVARO_gmp++_integer_INL
-
-// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen:foldmethod=syntax
-/*  -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-  */
diff --git a/src/kernel/gmp++/gmp++_int_add.C b/src/kernel/gmp++/gmp++_int_add.C
index e7f111a..579d396 100644
--- a/src/kernel/gmp++/gmp++_int_add.C
+++ b/src/kernel/gmp++/gmp++_int_add.C
@@ -9,113 +9,198 @@
 // $Id: gmp++_int_add.C,v 1.5 2010-12-20 12:09:37 bboyer Exp $
 // ==========================================================================
 
+/** @file gmp++/gmp++_int_add.C
+ * adding stuff.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_add_C
+#define __GIVARO_gmpxx_gmpxx_int_add_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+
 
 namespace Givaro {
-//-------------------------------------------------- operator +
-Integer& Integer::addin(Integer& res, const Integer& n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = n;
-  mpz_add( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
-  return res;
-}
-Integer& Integer::addin(Integer& res, const long n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = n;
-  int sgn = GMP__SGN(n);
-  if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
-  else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, -n);
-  return res;
-}
-Integer& Integer::addin(Integer& res, const unsigned long n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = n;
-  mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
-  return res;
-}
+	//-------------------------------------------------- operator +
+	Integer& Integer::addin(Integer& res, const Integer& n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		mpz_add( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
+		return res;
+	}
+	Integer& Integer::addin(Integer& res, const long int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		int sgn = Givaro::sign(n);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
+		else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, -n);
+		return res;
+	}
+	Integer& Integer::addin(Integer& res, const long unsigned int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
+		return res;
+	}
 
-Integer& Integer::add(Integer& res, const Integer& n1, const Integer& n2)
-{
-  if (isZero(n1)) return res = n2;
-  if (isZero(n2)) return res = n1;
-  mpz_add( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
-  return res;
-}
-Integer& Integer::add(Integer& res, const Integer& n1, const long n2)
-{
-  if (isZero(n1)) return res = n2;
-  if (isZero(n2)) return res = n1;
-  int sgn = GMP__SGN(n2);
-  if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
-  else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, -n2);
-  return res;
-}
-Integer& Integer::add(Integer& res, const Integer& n1, const unsigned long n2)
-{
-  if (isZero(n1)) return res = n2;
-  if (isZero(n2)) return res = n1;
-  mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
-  return res;
-}
+	Integer& Integer::add(Integer& res, const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		mpz_add( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
+		return res;
+	}
+	Integer& Integer::add(Integer& res, const Integer& n1, const long int n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		int sgn = Givaro::sign(n2);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, -n2);
+		return res;
+	}
+	Integer& Integer::add(Integer& res, const Integer& n1, const long unsigned int n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		return res;
+	}
 
+	// -- operator +
 
-Integer& Integer::operator += (const Integer& n)
-{
-  if (isZero(n)) return *this;
-  if (isZero(*this)) return logcpy(n);
-  mpz_add( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
-  return *this;
-}
+	Integer& Integer::operator += (const Integer& n)
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return logcpy(n);
+		mpz_add( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return *this;
+	}
 
-Integer& Integer::operator += (const unsigned long l)
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return logcpy(Integer(l));
-  mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
-  return *this;
-}
+	Integer& Integer::operator += (const long unsigned int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(l));
+		mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		return *this;
+	}
 
-Integer& Integer::operator += (const long l)
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return logcpy(Integer(l));
-  int sgn = GMP__SGN(l);
-  if (sgn >0) mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
-  else mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, -l);
-  return *this;
-}
+	Integer& Integer::operator += (const long int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(l));
+		int sgn = Givaro::sign(l);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		else mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, -l);
+		return *this;
+	}
 
 
-Integer Integer::operator + (const Integer& n) const
-{
-  if (isZero(n)) return *this;
-  if (isZero(*this)) return n;
-  Integer res;
-  mpz_add( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
-  return res;
-}
+	Integer Integer::operator + (const Integer& n) const
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return n;
+		Integer res;
+		mpz_add( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return res;
+	}
 
-Integer Integer::operator + (const unsigned long l) const
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return Integer(l);
-  Integer res;
-  mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
-  return res;
-}
+	Integer Integer::operator + (const long unsigned int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(l);
+		Integer res;
+		mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		return res;
+	}
+
+	Integer Integer::operator + (const long int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(l);
+		Integer res;
+		int sgn = Givaro::sign(l);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		else mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, -l);
+		return res;
+	}
+
+	Integer Integer::operator - () const
+	{
+		// JGD 18.06.1999
+		Integer Res ;
+		mpz_neg((mpz_ptr)&Res.gmp_rep, (mpz_srcptr)&gmp_rep );
+		return Res ;
+	}
+
+	Integer operator + (const int l, const Integer& n)
+	{
+		return n + (long)l;
+	}
+	Integer operator + (const unsigned int l, const Integer& n)
+	{
+		return n + (long unsigned)l;
+	}
+	Integer operator + (const long int l, const Integer& n)
+	{
+		return n + l;
+	}
+	Integer operator + (const long unsigned int l, const Integer& n)
+	{
+		return n + l;
+	}
+	Integer operator + (const Integer& n, const int l)
+	{
+		return n + (long)l;
+	}
+	Integer operator + (const Integer& n, const unsigned int l)
+	{
+		return n + (long unsigned)l;
+	}
+
+	Integer& operator += (Integer& n, const int l)
+	{
+		return n += (long)l;
+	}
+	Integer& operator += (Integer& n, const unsigned int l)
+	{
+		return n += (long unsigned)l;
+	}
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	Integer operator + (const Integer& n, const long long int l)
+	{
+		return n + (Integer)l;
+	}
+	Integer operator + (const Integer& n, const long long unsigned int l)
+	{
+		return n + (Integer)l;
+	}
+	Integer operator + (const long long int l, const Integer& n)
+	{
+		return n+l;
+	}
+	Integer operator + (const long long unsigned int l, const Integer& n)
+	{
+		return n+l;
+	}
+	Integer& operator += (Integer& n, const long long int l)
+	{
+		return n += (Integer)l;
+	}
+	Integer& operator += (Integer& n, const long long unsigned int l)
+	{
+		return n += (Integer)l;
+	}
+#endif
 
-Integer Integer::operator + (const long l) const
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return Integer(l);
-  Integer res;
-  int sgn = GMP__SGN(l);
-  if (sgn >0) mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
-  else mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, -l);
-  return res;
-}
 
 }
+
+#endif // __GIVARO_gmpxx_gmpxx_int_add_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_compare.C b/src/kernel/gmp++/gmp++_int_compare.C
index 92cb206..66f3de4 100644
--- a/src/kernel/gmp++/gmp++_int_compare.C
+++ b/src/kernel/gmp++/gmp++_int_compare.C
@@ -9,47 +9,520 @@
 // $Id: gmp++_int_compare.C,v 1.6 2009-09-17 14:28:22 jgdumas Exp $
 // ==========================================================================
 
+/*! @file gmp++/gmp++_int_compare.C
+ * @brief routines to compare integers.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_compare_C
+#define __GIVARO_gmpxx_gmpxx_int_compare_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#include <cstdlib>
 
 namespace Givaro {
 
-// returns 1 if a > b, 0 if a == b and -1 otherwise.
-int compare(const Integer &a, const Integer& b)
-{
-   return mpz_cmp ( (mpz_srcptr)&a.gmp_rep, (mpz_srcptr)&b.gmp_rep );
-}
+	int compare(const Integer &a, const Integer& b)
+	{
+		return mpz_cmp ( (mpz_srcptr)&a.gmp_rep, (mpz_srcptr)&b.gmp_rep );
+	}
 
-int absCompare(const Integer &a, const Integer &b)
-{
-   return mpz_cmpabs( (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep));
-}
+	// absCompare
+	int absCompare(const Integer &a, const Integer &b)
+	{
+		return mpz_cmpabs( (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep));
+	}
+
+	int absCompare(const Integer &a, const double b)
+	{
+		return mpz_cmpabs_d( (mpz_srcptr)&(a.gmp_rep), b);
+	}
+
+	int absCompare(const Integer &a, const float b)
+	{
+		return mpz_cmpabs_d( (mpz_srcptr)&(a.gmp_rep), (double)b);
+	}
+
+	int absCompare(const Integer &a, const long unsigned b)
+	{
+		return mpz_cmpabs_ui( (mpz_srcptr)&(a.gmp_rep), b);
+	}
+
+	int absCompare(const Integer &a, const unsigned b)
+	{
+		return mpz_cmpabs_ui( (mpz_srcptr)&(a.gmp_rep), (long unsigned)b);
+	}
+
+	int absCompare(const Integer &a, const long int b)
+	{
+		return mpz_cmpabs_ui( (mpz_srcptr)&(a.gmp_rep), (long unsigned) std::abs(b));
+	}
+
+	int absCompare(const Integer &a, const int b)
+	{
+		return mpz_cmpabs_ui( (mpz_srcptr)&(a.gmp_rep), (long unsigned) std::abs(b));
+	}
+
+	// Operator !=
+	int Integer::operator != (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) != 0;
+	}
+
+	int Integer::operator != (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) != 0;
+	}
+
+	int Integer::operator != (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float)  l) != 0;
+	}
+
+	int Integer::operator != (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) != 0;
+	}
+
+	int Integer::operator != (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) != 0;
+	}
+
+	int Integer::operator != (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) != 0;
+	}
+
+	int Integer::operator != (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) != 0;
+	}
+
+	//-------------------------------------------------inline comparaison operators
+	int operator != (double l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	int operator != (float l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	int operator != (int l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	int operator != (long int l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	int operator != (long unsigned int l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	int operator != (unsigned int l, const Integer& n)
+	{
+		return n.operator != (l);
+	}
+
+	// operator ==
+	int Integer::operator == (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) == 0;
+	}
+
+	int Integer::operator == (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) == 0;
+	}
+
+	int Integer::operator == (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float)  l) == 0;
+	}
+
+	int Integer::operator == (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) == 0;
+	}
+
+	int Integer::operator == (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) == 0;
+	}
+
+	int Integer::operator == (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) == 0;
+	}
+
+	int Integer::operator == (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) == 0;
+	}
+
+	//-------------------------------------------------inline comparaison operators
+	int operator == (double l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	int operator == (float l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	int operator == (int l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	int operator == (long int l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	int operator == (long unsigned int l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	int operator == (unsigned int l, const Integer& n)
+	{
+		return n.operator == (l);
+	}
+
+	// Operator >
+	int Integer::operator > (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) > 0;
+	}
+
+	int Integer::operator > (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) > 0;
+	}
+
+	int Integer::operator > (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float)  l) > 0;
+	}
+
+	int Integer::operator > (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0;
+	}
+
+	int Integer::operator > (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) > 0;
+	}
+
+	int Integer::operator > (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0;
+	}
+
+	int Integer::operator > (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) > 0;
+	}
 
-int Integer::operator != (const int l) const
-{ return mpz_cmp_si ( (mpz_srcptr)&gmp_rep, l ) != 0; }
+	//-------------------------------------------------inline comparaison operators
+	int operator > (double l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-int Integer::operator != (const long l) const
-{ return mpz_cmp_si ( (mpz_srcptr)&gmp_rep, l ) != 0; }
+	int operator > (float l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-//unsigned long ops added by Dan Roche, 6-26-04
-int Integer::operator != (const unsigned long l) const
-{ return mpz_cmp_ui ( (mpz_srcptr)&gmp_rep, l ) != 0; }
+	int operator > (int l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-int Integer::operator > (const unsigned long l) const
-{ return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) > 0; }
+	int operator > (long int l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-int Integer::operator < (const unsigned long l) const
-{ return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) < 0; }
+	int operator > (long unsigned int l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-int Integer::operator > (const int l) const
-{ return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0; }
+	int operator > (unsigned int l, const Integer& n)
+	{
+		return n.operator < (l);
+	}
 
-int Integer::operator > (const long l) const
-{ return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0; }
+	// Operator <
+	int Integer::operator < (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) < 0;
+	}
 
-int Integer::operator < (const int l) const
-{ return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0; }
+	int Integer::operator < (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) < 0;
+	}
 
-int Integer::operator < (const long l) const
-{ return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0; }
+	int Integer::operator < (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float) l) < 0;
+	}
+
+	int Integer::operator < (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) < 0;
+	}
+
+	int Integer::operator < (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+	int Integer::operator < (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+	int Integer::operator < (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+	//-------------------------------------------------inline comparaison operators
+	int operator < (double l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	int operator < (float l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	int operator < (int l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	int operator < (long int l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	int operator < (long unsigned int l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	int operator < (unsigned int l, const Integer& n)
+	{
+		return n.operator > (l);
+	}
+
+	// Operator >=
+	int Integer::operator >= (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) >= 0;
+	}
+
+	int Integer::operator >= (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) >= 0;
+	}
+
+	int Integer::operator >= (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float)  l) >= 0;
+	}
+
+	int Integer::operator >= (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) >= 0;
+	}
+
+	int Integer::operator >= (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) >= 0;
+	}
+
+	int Integer::operator >= (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) >= 0;
+	}
+
+	int Integer::operator >= (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) >= 0;
+	}
+
+	//-------------------------------------------------inline comparaison operators
+	int operator >= (double l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	int operator >= (float l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	int operator >= (int l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	int operator >= (long int l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	int operator >= (long unsigned int l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	int operator >= (unsigned int l, const Integer& n)
+	{
+		return n.operator <= (l);
+	}
+
+	// Operator <=
+	int Integer::operator <= (const Integer & l) const
+	{
+		return mpz_cmp((mpz_srcptr)&gmp_rep,  (mpz_srcptr)l.get_mpz_const()) <= 0;
+	}
+
+	int Integer::operator <= (const double l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep,  l) <= 0;
+	}
+
+	int Integer::operator <= (const float l) const
+	{
+		return mpz_cmp_d((mpz_srcptr)&gmp_rep, (float) l) <= 0;
+	}
+
+	int Integer::operator <= (const unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, (long unsigned) l) <= 0;
+	}
+
+	int Integer::operator <= (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) <= 0;
+	}
+
+	int Integer::operator <= (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) <= 0;
+	}
+
+	int Integer::operator <= (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) <= 0;
+	}
+
+	//-------------------------------------------------inline comparaison operators
+	int operator <= (double l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+	int operator <= (float l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+	int operator <= (int l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+	int operator <= (long int l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+	int operator <= (long unsigned int l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+	int operator <= (unsigned int l, const Integer& n)
+	{
+		return n.operator >= (l);
+	}
+
+
+	// compare to 1 and 0
+	int isOne(const Integer& a)
+	{
+		return ! mpz_cmp_ui((mpz_srcptr)&(a.gmp_rep), 1UL);
+	}
+
+	int nonZero(const Integer& a)
+	{
+		return mpz_cmp_ui((mpz_srcptr)&(a.gmp_rep), 0UL);
+		// return (mpz_sgn((mpz_srcptr)&(a.gmp_rep)) != 0) ; // BB which one is faster ?
+	}
+
+	int isZero(const Integer& a)
+	{
+		return ! mpz_cmp_ui((mpz_srcptr)&(a.gmp_rep), 0UL);
+		// return (mpz_sgn((mpz_srcptr)&(a.gmp_rep)) == 0) ; // BB which one is faster ?
+	}
+	int isZero(const short int a)
+	{
+		return a ==0;
+	}
+	int isZero(const int a)
+	{
+		return a ==0;
+	}
+	int isZero(const long int a)
+	{
+		return a ==0;
+	}
+	int isZero(const unsigned short int a)
+	{
+		return a ==0;
+	}
+	int isZero(const unsigned int a)
+	{
+		return a ==0;
+	}
+	int isZero(const long unsigned int a)
+	{
+		return a ==0UL;
+	}
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+#if 1 /*  use of C++0x long long integer constant */
+	int isZero(const long long unsigned int a)
+	{
+		return a ==0ULL;
+	}
+#endif
+	int isZero(const long long int a)
+	{
+		return a ==0LL;
+	}
+#endif
 
 }
+
+#endif // __GIVARO_gmpxx_gmpxx_int_compare_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/gmp++/gmp++_int_cstor.C b/src/kernel/gmp++/gmp++_int_cstor.C
index 584a21a..004ae9b 100644
--- a/src/kernel/gmp++/gmp++_int_cstor.C
+++ b/src/kernel/gmp++/gmp++_int_cstor.C
@@ -8,37 +8,146 @@
 // Authors: M. Samama, T. Gautier
 // $Id: gmp++_int_cstor.C,v 1.4 2009-09-17 14:28:22 jgdumas Exp $
 // ==========================================================================
+/** @file gmp++/gmp++_int_cstor.C
+ * cstoring stuff.
+ */
+
 #ifndef __GMPplusplus_CSTOR_C__
 #define __GMPplusplus_CSTOR_C__
 #include <iostream>
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
 
 
 namespace Givaro {
-//------------------------------------- predefined null and one
-const Integer Integer::zero(0UL);
-const Integer Integer::one(1UL);
+	//-----------------------------~Integer()
+	Integer::~Integer()
+	{
+		mpz_clear((mpz_ptr)&gmp_rep) ;
+	}
 
+	//-------------------------------Integer(const Integer &n)
+	Integer::Integer(const Integer &n)
+	{
+		mpz_init_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
+	}
 
-// -- Integer(const char *s)
-Integer::Integer(const char *s)
-{
-  mpz_init_set_str((mpz_ptr)&gmp_rep, s, 10);
-}
+	//-----------------------------Integer(int n)
+	Integer::Integer(int n)
+	{
+		mpz_init_set_si((mpz_ptr)&gmp_rep, n) ;
+	}
 
+	//-----------------------------Integer(uint n)
+	Integer::Integer(unsigned char n)
+	{
+		mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
+	}
 
-Integer& Integer::copy(const Integer &n)
-{
-  if (this == &n) return *this;
-  mpz_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
-  return *this ;
-}
+	//-----------------------------Integer(uint n)
+	Integer::Integer(unsigned int n)
+	{
+		mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
+	}
+
+	//-----------------------------Integer(long int n)
+	Integer::Integer(long int n)
+	{
+		mpz_init_set_si((mpz_ptr)&gmp_rep, n) ;
+	}
+
+	//-----------------------------Integer(long unsigned int n)
+	Integer::Integer(long unsigned int n)
+	{
+		mpz_init_set_ui((mpz_ptr)&gmp_rep, n) ;
+	}
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+#include <stdio.h>
+	//-----------------------------Integer(long long int n)
+	// log[10](2^8) < 2.408239966
+	Integer::Integer(long long int n)
+	{
+		char * tmp = new char[long(2.408239966*sizeof(long long))+1]; sprintf(tmp,"%lld",n);
+		mpz_init_set_str((mpz_ptr)&gmp_rep, tmp, 10) ;
+		delete [] tmp;
+	}
+
+	//-----------------------------Integer(long long unsigned int n)
+	// log[10](2^8) < 2.408239966
+	Integer::Integer(long long unsigned int n)
+	{
+		char * tmp = new char[ long(2.408239966*sizeof(long long unsigned))+1];
+		sprintf(tmp,"%llu",n);
+		mpz_init_set_str((mpz_ptr)&gmp_rep, tmp, 10) ;
+		delete [] tmp;
+	}
+#endif
+
+
+	//-----------------------------Integer(double)
+	Integer::Integer(double d)
+	{
+		mpz_init_set_d((mpz_ptr)&gmp_rep, d) ;
+	}
+
+	// -- Integer(const char *s)
+	Integer::Integer(const char *s)
+	{
+		mpz_init_set_str((mpz_ptr)&gmp_rep, s, 10);
+	}
+
+	//------------------------------------------operator = (const Integer &n)
+	Integer& Integer::logcpy(const Integer &n)
+	{
+		if (this == &n) return *this;
+		mpz_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
+		return *this;
+	}
+
+	// same as logcopy
+	Integer& Integer::operator = (const Integer &n)
+	{
+		return logcpy(n) ;
+	}
+
+
+	Integer& Integer::copy(const Integer &n)
+	{
+		if (this == &n) return *this;
+		mpz_set ( (mpz_ptr)&gmp_rep, (mpz_srcptr)&(n.gmp_rep)) ;
+		return *this ;
+	}
+
+	void importWords(Integer& x, size_t count, int order, int size,
+			 int endian, size_t nails, const void* op)
+	{
+		mpz_import( (mpz_ptr)&(x.gmp_rep), count, order, size, endian, nails, op);
+	}
+
+	Integer::Integer(const vect_t & v)
+	{
+		size_t s = v.size();
+		if (s) {
+			mpz_init_set_ui((mpz_ptr)&gmp_rep, v[0]);
+			Integer base(256), prod, tmp;
+			prod = base = pow(base, (long unsigned)sizeof(mp_limb_t) );
+
+			std::vector<mp_limb_t>::const_iterator vi = v.begin();
+			for(++vi;vi != v.end();++vi) {
+				mpz_mul_ui( (mpz_ptr)&tmp.gmp_rep, (mpz_ptr)&prod.gmp_rep, *vi);
+				*this += tmp;
+				prod *= base;
+			}
+		} else
+			mpz_init( (mpz_ptr)&gmp_rep );
+
+	}
 
-void importWords(Integer& x, size_t count, int order, int size, int endian, size_t nails, const void* op) {
-  mpz_import( (mpz_ptr)&(x.gmp_rep), count, order, size, endian, nails, op);
-}
 
 }
 
 #endif
 
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_div.C b/src/kernel/gmp++/gmp++_int_div.C
index 37a33fa..fb25831 100644
--- a/src/kernel/gmp++/gmp++_int_div.C
+++ b/src/kernel/gmp++/gmp++_int_div.C
@@ -8,265 +8,364 @@
 // Authors: M. Samama, T. Gautier
 // $Id: gmp++_int_div.C,v 1.9 2011-01-06 18:02:37 bboyer Exp $
 // ==========================================================================
+/** @file gmp++/gmp++_int_div.C
+ * diving stuff.
+ */
 
+#ifndef __GIVARO_gmpxx_gmpxx_int_div_C
+#define __GIVARO_gmpxx_gmpxx_int_div_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#include <cstdlib>
 
 namespace Givaro {
 
-//-------------------------------------------------- operator /
-Integer& Integer::divin(Integer& res, const Integer& n)
-{
-	//  if (isZero(n)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(res)) return res;
-	mpz_tdiv_q( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
-	return res;
-}
-
-Integer& Integer::divin(Integer& res, const long n)
-{
-	//  if (n ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(res)) return res;
-	int sgn = GMP__SGN(n);
-	mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, GMP__ABS(n));
-	if (sgn <0) return res = -res;
-	// if (n<0)
-	// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&res.gmp_rep, n);
-	// else
-	// mpz_cdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&res.gmp_rep, n);
-
-
-	return res;
-}
+	//-------------------------------------------------- operator /
+	Integer& Integer::divin(Integer& res, const Integer& n)
+	{
+		//  if (isZero(n)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(res)) return res;
+		mpz_tdiv_q( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
+		return res;
+	}
 
-Integer& Integer::divin(Integer& res, const unsigned long n)
-{
-	//  if (n ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(res)) return res;
-	mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
-	return res;
-}
+	Integer& Integer::divin(Integer& res, const long int n)
+	{
+		//  if (n ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(res)) return res;
+		int sgn = Givaro::sign(n);
+		mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, std::abs(n));
+		if (sgn <0) return res = -res;
+		// if (n<0)
+		// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&res.gmp_rep, n);
+		// else
+		// mpz_cdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&res.gmp_rep, n);
+
+
+		return res;
+	}
 
-Integer& Integer::div(Integer& res, const Integer& n1, const Integer& n2)
-{
-	if (isZero(n1)) return res = Integer::zero;
-	//  if (isZero(n2)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	mpz_tdiv_q( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
-	return res;
-}
+	Integer& Integer::divin(Integer& res, const long unsigned int n)
+	{
+		//  if (n ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(res)) return res;
+		mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
+		return res;
+	}
 
-Integer& Integer::div(Integer& res, const Integer& n1, const long n2)
-{
-	if (isZero(n1)) return res = Integer::zero;
-	//  if (isZero(n2)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	int sgn = GMP__SGN(n2);
-	mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, GMP__ABS(n2));
-	if (sgn <0) return res = -res;
+	Integer& Integer::div(Integer& res, const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return res = Integer::zero;
+		//  if (isZero(n2)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		mpz_tdiv_q( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
+		return res;
+	}
 
-	// if (n2>0)
-	// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&n1.gmp_rep, n2);
-	// else
-	// mpz_cdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&n1.gmp_rep, n2);
+	Integer& Integer::div(Integer& res, const Integer& n1, const long int n2)
+	{
+		if (isZero(n1)) return res = Integer::zero;
+		//  if (isZero(n2)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		int sgn = Givaro::sign(n2);
+		mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, std::abs(n2));
+		if (sgn <0) return res = -res;
 
+		// if (n2>0)
+		// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&n1.gmp_rep, n2);
+		// else
+		// mpz_cdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&n1.gmp_rep, n2);
 
-	return res;
-}
 
+		return res;
+	}
 
-Integer& Integer::div(Integer& res, const Integer& n1, const int n2) {
-	return div(res,n1,long(n2));
-}
+	Integer& Integer::div(Integer& res, const Integer& n1, const int n2)
+	{
+		return div(res,n1,long(n2));
+	}
 
-Integer& Integer::div(Integer& res, const Integer& n1, const unsigned long n2)
-{
-	if (isZero(n1)) return res = Integer::zero;
-	//  if (isZero(n2)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
-	return res;
-}
+	Integer& Integer::div(Integer& res, const Integer& n1, const long unsigned int n2)
+	{
+		if (isZero(n1)) return res = Integer::zero;
+		//  if (isZero(n2)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		mpz_tdiv_q_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		return res;
+	}
 
-Integer& Integer::divexact  (Integer& q, const Integer& n1, const Integer& n2)
-{
-	if (isZero(n1)) return q = Integer::zero;
-	//  if (isZero(n2)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	mpz_divexact( (mpz_ptr)&(q.gmp_rep),
-		      (mpz_srcptr)&(n1.gmp_rep), (mpz_srcptr)&(n2.gmp_rep)) ;
-	return q;
-}
+	Integer& Integer::divexact  (Integer& q, const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return q = Integer::zero;
+		//  if (isZero(n2)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		mpz_divexact( (mpz_ptr)&(q.gmp_rep),
+			      (mpz_srcptr)&(n1.gmp_rep), (mpz_srcptr)&(n2.gmp_rep)) ;
+		return q;
+	}
 
-Integer  Integer::divexact  (const Integer& n1, const Integer& n2)
-{
-	if (isZero(n1)) return Integer::zero;
-	//  if (isZero(n2)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	Integer q;
-	mpz_divexact( (mpz_ptr)&(q.gmp_rep),
-		      (mpz_srcptr)&(n1.gmp_rep), (mpz_srcptr)&(n2.gmp_rep)) ;
-	return q;
-}
+	Integer  Integer::divexact  (const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return Integer::zero;
+		//  if (isZero(n2)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		Integer q;
+		mpz_divexact( (mpz_ptr)&(q.gmp_rep),
+			      (mpz_srcptr)&(n1.gmp_rep), (mpz_srcptr)&(n2.gmp_rep)) ;
+		return q;
+	}
 
 
-Integer& Integer::operator /= (const Integer& n)
-{
-	//  if (isZero(n)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return *this;
-	mpz_tdiv_q( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
-	return *this;
-}
+	Integer& Integer::operator /= (const Integer& n)
+	{
+		//  if (isZero(n)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return *this;
+		mpz_tdiv_q( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return *this;
+	}
 
-Integer& Integer::operator /= (const unsigned long l)
-{
-	//  if (l ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return *this;
-	mpz_tdiv_q_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
-	return *this;
-}
+	Integer& Integer::operator /= (const long unsigned int l)
+	{
+		//  if (l ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return *this;
+		mpz_tdiv_q_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		return *this;
+	}
 
-Integer& Integer::operator /= (const long l)
-{
-	//  if (l ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return *this;
-	int sgn = GMP__SGN(l);
-	mpz_tdiv_q_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, GMP__ABS(l));
-	if (sgn <0) mpz_neg( (mpz_ptr)&gmp_rep, (mpz_ptr)&(gmp_rep));
-	return *this;
-}
+	Integer& Integer::operator /= (const long int l)
+	{
+		//  if (l ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return *this;
+		int sgn = Givaro::sign(l);
+		mpz_tdiv_q_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, std::abs(l));
+		if (sgn <0) mpz_neg( (mpz_ptr)&gmp_rep, (mpz_ptr)&(gmp_rep));
+		return *this;
+	}
 
 
-Integer Integer::operator / (const Integer& n) const
-{
-	//  if (isZero(n)) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return Integer::zero;
-	Integer res;
-	mpz_tdiv_q( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+	Integer Integer::operator / (const Integer& n) const
+	{
+		//  if (isZero(n)) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return Integer::zero;
+		Integer res;
+		mpz_tdiv_q( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
 
-	// if (n>0)
+		// if (n>0)
 		// mpz_fdiv_q( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, (mpz_ptr)&n.gmp_rep) ;
-	// else
+		// else
 		// mpz_cdiv_q( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, (mpz_ptr)&n.gmp_rep) ;
 
-	return res;
-}
+		return res;
+	}
 
-Integer Integer::operator / (const unsigned long l) const
-{
-	//  if (l ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return Integer::zero;
-	Integer res;
-	mpz_tdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+	Integer Integer::operator / (const long unsigned int l) const
+	{
+		//  if (l ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return Integer::zero;
+		Integer res;
+		mpz_tdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
 
-	return res;
-}
+		return res;
+	}
 
-Integer Integer::operator / (const long l) const
-{
-	//  if (l ==0) {
-	//    GivMathDivZero("[Integer::/]: division by zero");
-	//  }
-	if (isZero(*this)) return Integer::zero;
-	Integer res;
-	int sgn = GMP__SGN(l);
-	mpz_tdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, GMP__ABS(l));
-	if (sgn <0) return negin(res);
-	// if (l>0)
+	Integer Integer::operator / (const long int l) const
+	{
+		//  if (l ==0) {
+		//    GivMathDivZero("[Integer::/]: division by zero");
+		//  }
+		if (isZero(*this)) return Integer::zero;
+		Integer res;
+		int sgn = Givaro::sign(l);
+		mpz_tdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, std::abs(l));
+		if (sgn <0) return negin(res);
+		// if (l>0)
 		// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, l) ;
-	// else
+		// else
 		// mpz_fdiv_q_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, -l ) ;
 
 
-	return res;
-}
+		return res;
+	}
 
-// -- Euclidian division
-Integer& Integer::divmod(Integer& q, Integer& r, const Integer &a, const Integer &b)
-{
-	//  if (isZero(b)) {
-	//    GivMathDivZero("[Integer::divide]: division by zero");
-	//  }
+	// Euclidian division
+	Integer& Integer::divmod(Integer& q, Integer& r, const Integer &a, const Integer &b)
+	{
+		//  if (isZero(b)) {
+		//    GivMathDivZero("[Integer::divide]: division by zero");
+		//  }
 
-	mpz_tdiv_qr( (mpz_ptr)&(q.gmp_rep), (mpz_ptr)&(r.gmp_rep),
-		     (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep));
-	// if (a>0)
+		mpz_tdiv_qr( (mpz_ptr)&(q.gmp_rep), (mpz_ptr)&(r.gmp_rep),
+			     (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep));
+		// if (a>0)
 		// mpz_fdiv_qr_ui( (mpz_ptr)&(q.gmp_rep),r
-				// (mpz_ptr)&(a.gmp_rep), b);
-	// else
+		// (mpz_ptr)&(a.gmp_rep), b);
+		// else
 		// mpz_cdiv_qr_ui( (mpz_ptr)&(q.gmp_rep),r
-				// (mpz_ptr)&(a.gmp_rep), b);
+		// (mpz_ptr)&(a.gmp_rep), b);
 
-	if (a<0 && r) {
-		subin(q,(long)1) ;
-		r = b - r;
-	}
+		if (a<0 && r) {
+			subin(q,(long)1) ;
+			r = b - r;
+		}
 
 
-	return q;
-}
+		return q;
+	}
 
-Integer& Integer::divmod(Integer& q, long& r, const Integer& a, const long b)
-{
-	//  if (isZero(b)) {
-	//    GivMathDivZero("[Integer::divide]: division by zero");
-	//  }
-	// int sgn = GMP__SGN(b);
-	r = mpz_tdiv_q_ui( (mpz_ptr)&(q.gmp_rep),
-			   (mpz_srcptr)&(a.gmp_rep), GMP__ABS(b));
-	// if (sgn <0) return negin(q);
-	// if (a>0)
+	Integer& Integer::divmod(Integer& q, long int & r, const Integer& a, const long int b)
+	{
+		//  if (isZero(b)) {
+		//    GivMathDivZero("[Integer::divide]: division by zero");
+		//  }
+		// int sgn = sign(b);
+		r = (long)mpz_tdiv_q_ui( (mpz_ptr)&(q.gmp_rep),
+					 (mpz_srcptr)&(a.gmp_rep), std::abs(b));
+		// if (sgn <0) return negin(q);
+		// if (a>0)
 		// mpz_fdiv_qr_ui( (mpz_ptr)&(q.gmp_rep),r
-				// (mpz_ptr)&(a.gmp_rep), b);
-	// else
+		// (mpz_ptr)&(a.gmp_rep), b);
+		// else
 		// mpz_cdiv_qr_ui( (mpz_ptr)&(q.gmp_rep),r
-				// (mpz_ptr)&(a.gmp_rep), b);
-	if (a<0 && r) {
-		subin(q,(long)1) ;
-		r = b - r ;
+		// (mpz_ptr)&(a.gmp_rep), b);
+		if (a<0 && r) {
+			subin(q,(long)1) ;
+			r = b - r ;
+		}
+
+
+
+		return q;
 	}
 
+	Integer& Integer::divmod(Integer& q, long unsigned int & r, const Integer& a, const long unsigned int b)
+	{
+		//  if (isZero(b)) {
+		//    GivMathDivZero("[Integer::divide]: division by zero");
+		//  }
+		r = mpz_tdiv_q_ui( (mpz_ptr)&(q.gmp_rep),
+				   (mpz_srcptr)&(a.gmp_rep), b);
 
+		if (a<0 && r) {
+			subin(q,(long)1) ;
+			r = b - r;
+		}
 
-	return q;
-}
+		return q;
+	}
 
-Integer& Integer::divmod(Integer& q, unsigned long& r, const Integer& a, const unsigned long b)
-{
-	//  if (isZero(b)) {
-	//    GivMathDivZero("[Integer::divide]: division by zero");
-	//  }
-	r = mpz_tdiv_q_ui( (mpz_ptr)&(q.gmp_rep),
-			   (mpz_srcptr)&(a.gmp_rep), b);
-
-	if (a<0 && r) {
-		subin(q,(long)1) ;
-		r = b - r;
+	Integer& Integer::ceil(Integer& q, const Integer & n, const Integer & d)
+	{
+		mpz_cdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+	Integer& Integer::floor(Integer& q, const Integer & n, const Integer & d)
+	{
+		mpz_fdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+	Integer& Integer::trunc(Integer& q, const Integer & n, const Integer & d)
+	{
+		mpz_tdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+	Integer Integer::ceil( const Integer & n, const Integer & d)
+	{
+		Integer q;
+		mpz_cdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+	Integer Integer::floor(const Integer & n, const Integer & d)
+	{
+		Integer q;
+		mpz_fdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+	Integer Integer::trunc(const Integer & n, const Integer & d)
+	{
+		Integer q;
+		mpz_tdiv_q( (mpz_ptr)&(q.gmp_rep),
+			    (mpz_srcptr)&(n.gmp_rep),
+			    (mpz_srcptr)&(d.gmp_rep));
+		return q ;
+	}
+
+
+	// -- operator /
+	Integer operator / (const int l, const Integer& n)
+	{
+		return Integer(l)/n;
+	}
+	Integer operator / (const long int l, const Integer& n)
+	{
+		return Integer(l)/n;
+	}
+	Integer operator / (const Integer& n, const int l)
+	{
+		return n / (long)l;
+	}
+	Integer operator / (const Integer& n, const unsigned int l)
+	{
+		return n / (long unsigned)l;
+	}
+
+	Integer& operator /= (Integer& n, const int l)
+	{
+		if (l>=0)
+			return n /= (long unsigned)l;
+		else
+			return  n = -(n / (long unsigned)-l);
+	}
+	Integer& operator /= (Integer& n, const long int l)
+	{
+		return n /= (long unsigned)l;
+	}
+	Integer& operator /= (Integer& n, const unsigned int l)
+	{
+		return n /= (long unsigned)l;
 	}
 
-	return q;
-}
 
 }
+
+#endif // __GIVARO_gmpxx_gmpxx_int_div_C
+
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_gcd.C b/src/kernel/gmp++/gmp++_int_gcd.C
index f0ccae6..23571da 100644
--- a/src/kernel/gmp++/gmp++_int_gcd.C
+++ b/src/kernel/gmp++/gmp++_int_gcd.C
@@ -10,87 +10,107 @@
 // ==========================================================================
 // Description:
 //
+/** @file gmp++/gmp++_int_gcd.C
+ * gcding stuff.
+ */
 
+#ifndef __GIVARO_gmpxx_gmpxx_int_gcd_C
+#define __GIVARO_gmpxx_gmpxx_int_gcd_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
 
 namespace Givaro {
-// ==========================================================================
-// Computes and returns the lcm of the two integers a and b.
-Integer lcm(const Integer& a, const Integer& b) {
-  Integer Res(Integer::one);
-  mpz_lcm( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (Res.priv_sign() <0) return -Res;
-  else return Res ;
-}
+	// ==========================================================================
+	// Computes and returns the lcm of the two integers a and b.
+	Integer lcm(const Integer& a, const Integer& b) {
+		Integer Res(Integer::one);
+		mpz_lcm( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (Res.priv_sign() <0) return -Res;
+		else return Res ;
+	}
 
-Integer& lcm(Integer& g, const Integer& a, const Integer& b) {
-  mpz_lcm( (mpz_ptr)&(g.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (g.priv_sign() <0) return Integer::negin(g);
-  else return g ;
-}
+	Integer& lcm(Integer& g, const Integer& a, const Integer& b) {
+		mpz_lcm( (mpz_ptr)&(g.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (g.priv_sign() <0) return Integer::negin(g);
+		else return g ;
+	}
 
 
-// ==========================================================================
-// Computes and returns the gcd of the two integers a and b.
-Integer gcd(const Integer& a, const Integer& b) {
-  Integer Res(Integer::one);
-  mpz_gcd( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (Res.priv_sign() <0) return -Res;
-  return Res ;
-}
+	// ==========================================================================
+	// Computes and returns the gcd of the two integers a and b.
+	Integer gcd(const Integer& a, const Integer& b)
+	{
+		Integer Res(Integer::one);
+		mpz_gcd( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (Res.priv_sign() <0) return -Res;
+		return Res ;
+	}
 
-Integer& gcd(Integer& g, const Integer& a, const Integer& b) {
-  mpz_gcd( (mpz_ptr)&(g.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (g.priv_sign() <0) return Integer::negin(g);
-  return g ;
-}
+	Integer& gcd(Integer& g, const Integer& a, const Integer& b)
+	{
+		mpz_gcd( (mpz_ptr)&(g.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (g.priv_sign() <0) return Integer::negin(g);
+		return g ;
+	}
 
-Integer& invin(Integer& u, const Integer& b) {
-  mpz_invert( (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  return u ;
-}
+	Integer& invin(Integer& u, const Integer& b) {
+		mpz_invert( (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		return u ;
+	}
 
-Integer& inv(Integer& u, const Integer& a, const Integer& b) {
-  mpz_invert( (mpz_ptr)&(u.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  return u ;
-}
+	Integer& inv(Integer& u, const Integer& a, const Integer& b) {
+		mpz_invert( (mpz_ptr)&(u.gmp_rep), (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		return u ;
+	}
 
-// ==========================================================================
-// Computes and returns the gcd g of the two integers a and b such that
-// g = a*u + b*v .
-// The algorithm used is this of Gmp.
-Integer  gcd (const Integer& a, const Integer& b, Integer& u, Integer& v)
-{
-  v = 1; // v must not be 0 to be computed.
-  Integer Res(Integer::one);
-  mpz_gcdext( (mpz_ptr)&(Res.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(v.gmp_rep),
-              (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (Res.priv_sign() < 0) { Integer::negin(u); Integer::negin(v); return Integer::negin(Res);}
-//   { u = -u ; v = -v ; return -Res;}
-  return Res;
-}
+	// ==========================================================================
+	// Computes and returns the gcd g of the two integers a and b such that
+	// g = a*u + b*v .
+	// The algorithm used is this of Gmp.
+	Integer  gcd (Integer& u, Integer& v,
+			const Integer& a, const Integer& b )
+	{
+		v = 1; // v must not be 0 to be computed.
+		Integer Res(Integer::one);
+		mpz_gcdext( (mpz_ptr)&(Res.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(v.gmp_rep),
+				(mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (Res.priv_sign() < 0) {
+			Integer::negin(u);
+			Integer::negin(v);
+			return Integer::negin(Res);
+		}
+		//   { u = -u ; v = -v ; return -Res;}
+		return Res;
+	}
 
-Integer&  gcd (Integer& g, const Integer& a, const Integer& b, Integer& u, Integer& v)
-{
-  v = 1; // v must not be 0 to be computed.
-  mpz_gcdext( (mpz_ptr)&(g.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(v.gmp_rep),
-              (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
-  if (g.priv_sign() < 0) { Integer::negin(u); Integer::negin(v); return Integer::negin(g);}
-  return g;
-}
+	Integer&  gcd (Integer& g, Integer& u, Integer& v,
+			const Integer& a, const Integer& b)
+	{
+		v = 1; // v must not be 0 to be computed.
+		mpz_gcdext( (mpz_ptr)&(g.gmp_rep), (mpz_ptr)&(u.gmp_rep), (mpz_ptr)&(v.gmp_rep),
+				(mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep) ) ;
+		if (g.priv_sign() < 0) { Integer::negin(u); Integer::negin(v); return Integer::negin(g);}
+		return g;
+	}
 
 
-Integer pp( const Integer& P, const Integer& Q )
-{
-  Integer U = P ;
-  Integer V = gcd(P,Q) ;
-  // -- computes the prime part U of g relatively to U
-  while ( V != Integer::one )
-  {
-    U = U / V ;
-    V = gcd( U,V) ;
-  }
-  return U ;
-}
+	Integer pp( const Integer& P, const Integer& Q )
+	{
+		Integer U = P ;
+		Integer V = gcd(P,Q) ;
+		// -- computes the prime part U of g relatively to U
+		while ( V != Integer::one )
+		{
+			U = U / V ;
+			V = gcd( U,V) ;
+		}
+		return U ;
+	}
 
 }
+
+#endif // __GIVARO_gmpxx_gmpxx_int_gcd_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_io.C b/src/kernel/gmp++/gmp++_int_io.C
index 81313c9..db64d1b 100644
--- a/src/kernel/gmp++/gmp++_int_io.C
+++ b/src/kernel/gmp++/gmp++_int_io.C
@@ -9,151 +9,139 @@
 // $Id: gmp++_int_io.C,v 1.7 2009-09-17 14:28:22 jgdumas Exp $
 // ==========================================================================
 // Description:
+/** @file gmp++/gmp++_int_io.C
+ * ioing stuff.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_io_C
+#define __GIVARO_gmpxx_gmpxx_int_io_C
 
 #include <iostream>
 #include <stdlib.h>
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#ifndef __GIVARO_GMP_NO_CXX
+#include <sstream>
+#endif
 
 
 namespace Givaro {
 
-// Sortie nonsignee : 321321 meme si n = -321321, par exemple
-std::ostream& absOutput(std::ostream &o, const Integer&n)
-{
-  int base = 10;
-
-  unsigned long strSize = mpz_sizeinbase((mpz_srcptr)&(n.gmp_rep), base) + 2;
-  char *str = ::new char[strSize];
-  mpz_get_str(str, base, (mpz_srcptr)&(n.gmp_rep));
-  if (sign(n) < 0) {
-      char *str1 = &(str[1]) ;
-      o << str1;
-  }
-  else o << str;
-  delete [] str ;
-  return o;
-}
-
-// Sortie signee : +321321 ou -321321, par exemple
-std::ostream& Integer::print(std::ostream &o) const
-{
-  int base = 10;
-  unsigned long strSize = mpz_sizeinbase((mpz_srcptr)&(gmp_rep), base) + 2;
-  char *str = new char[strSize];
-  mpz_get_str(str, base, (mpz_srcptr)&(gmp_rep));
-// JGD 08.11.1999 : temporaire
-//   if (sign(*this) > 0) o << '+' ;
-  o << str;
-  delete [] str ;
-  return o;
-}
-
-Integer::operator std::string () const {
-    std::string s;
-    unsigned long strSize = mpz_sizeinbase((mpz_srcptr)&(gmp_rep), 10) + 2;
-    char *str = new char[strSize + 2];
-    mpz_get_str(str, 10, (mpz_srcptr)&(gmp_rep));
-    s = std::string(str);
-    delete [] str ;
-    return s;
-}
-
-
-
-Integer::Integer(const std::vector<mp_limb_t>& v) {
- 	size_t s = v.size();
-	if (s) {
-	 	mpz_init_set_ui((mpz_ptr)&gmp_rep, v[0]);
-		Integer base(256), prod, tmp;
-		prod = base = pow(base, (unsigned long)sizeof(mp_limb_t) );
-
-		std::vector<mp_limb_t>::const_iterator vi = v.begin();
-		for(++vi;vi != v.end();++vi) {
-			mpz_mul_ui( (mpz_ptr)&tmp.gmp_rep, (mpz_ptr)&prod.gmp_rep, *vi);
-	 		*this += tmp;
-			prod *= base;
+	// Sortie nonsignee : 321321 meme si n = -321321, par exemple
+	std::ostream& absOutput(std::ostream &o, const Integer&n)
+	{
+		int base = 10;
+
+		long unsigned strSize = mpz_sizeinbase((mpz_srcptr)&(n.gmp_rep), base) + 2;
+		char *str = ::new char[strSize];
+		mpz_get_str(str, base, (mpz_srcptr)&(n.gmp_rep));
+		if (sign(n) < 0) {
+			char *str1 = &(str[1]) ;
+			o << str1;
 		}
-	} else
-	 	mpz_init( (mpz_ptr)&gmp_rep );
-
-}
+		else o << str;
+		delete [] str ;
+		return o;
+	}
+
+	// Sortie signee : +321321 ou -321321, par exemple
+	std::ostream& Integer::print(std::ostream &o) const
+	{
+#ifdef __GIVARO_GMP_NO_CXX
+		int base = 10;
+		long unsigned strSize = mpz_sizeinbase((mpz_srcptr)&(gmp_rep), base) + 2;
+		char *str = new char[strSize];
+		mpz_get_str(str, base, (mpz_srcptr)&(gmp_rep));
+		// JGD 08.11.1999 : temporaire
+		//   if (sign(*this) > 0) o << '+' ;
+		o << str;
+		delete [] str ;
+		return o;
+#else
+		return o << (mpz_srcptr)&gmp_rep;
+#endif
+	}
+
+	// Entree au format de la sortie
+	std::istream& operator>> (std::istream& inp, Integer& a)
+	{
+#ifdef __GIVARO_GMP_NO_CXX
+		static long int base[10] = {
+			10,
+			100,
+			1000,
+			10000,
+			100000,
+			1000000,
+			10000000,
+			100000000,
+			1000000000
+		} ;
+		if (!inp) return inp ;
+		// eat white
+		inp >> std::ws  ;
+
+		// Base : 10^9, we read by packet of length 9
+		// the char.
+		char Tmp[10] ;
+		int counter = 0 ;
+
+		// Set the returned integer
+		a = 0L ;
+		char ch ;
+		int sign = 1 ;
+
+		// find a sign:
+		inp.get(ch) ;
+		if ((ch != '+') && (ch != '-') && !((ch >= '0') && (ch <= '9')))
+		{
+			std::cerr << "Bad integer format: found: "<< ch ;
+			std::cerr << ", in place of '+' '-' or a digit"<< std::endl ;
+			return inp ;
+		}
+		switch (ch) {
+		case '+' : break ;
+		case '-' : sign = -1 ; break ;
+		default  : inp.putback(ch) ; break ;
+		}
+		// eat white
+		inp >> std::ws  ;
+
+		int noend = 1 ;
+		while (noend)
+		{
+			counter = 0 ;
+
+			// Read 9 digits or less
+			while ((noend) && (counter < 9)) {
+				inp.get(ch) ;
+				if (inp.eof()) { noend = 0 ; }
+				else if ((ch >= '0') && (ch <= '9')) Tmp[counter++] = ch ;
+				else { noend = 0 ;  inp.putback(ch) ; }
+			}
+			if (counter >0) {
+				long int l ;
+				Tmp[counter] = '\0' ; // terminate the string
+				l = atol(Tmp) ;
+				a = a * base[counter-1] + l ;
+			}
+		}
+		if (sign == -1) a = -a ;
+		return inp ;
+#else
+		return inp >>  (mpz_ptr)a.get_mpz();
+#endif
+	}
+
+	//-------------------------------------------------inline >> & << operators
+	std::ostream& operator<< (std::ostream& o, const Integer& a)
+	{
+		return a.print(o);
+	}
 
-Integer::operator std::vector<mp_limb_t> () const {
-        size_t s = mpz_size( (mpz_srcptr)&(gmp_rep) );
-        std::vector<mp_limb_t> v(s);
-        std::vector<mp_limb_t>::iterator vi = v.begin();
-        for(mp_size_t i = 0;vi != v.end();++vi, ++i)
-			*vi = mpz_getlimbn( (mpz_srcptr)& (gmp_rep) ,i);
-        return v;
 }
 
+#endif // __GIVARO_gmpxx_gmpxx_int_io_C
 
-
-  // Entree au format de la sortie
-std::istream& operator>> (std::istream& in, Integer& a)
-{
-   static long base[10] = {
-     10,
-     100,
-     1000,
-     10000,
-     100000,
-     1000000,
-     10000000,
-     100000000,
-     1000000000
-   } ;
-   if (!in) return in ;
-   // eat white
-   in >> std::ws  ;
-
-   // Base : 10^9, we read by packet of length 9
-   // the char.
-   char Tmp[10] ;
-   int counter = 0 ;
-
-   // Set the returned integer
-   a = 0L ;
-   char ch ;
-   int sign = 1 ;
-
-   // find a sign:
-   in.get(ch) ;
-   if ((ch != '+') && (ch != '-') && !((ch >= '0') && (ch <= '9')))
-   {
-      std::cerr << "Bad integer format: found: "<< ch ;
-      std::cerr << ", in place of '+' '-' or a digit"<< std::endl ;
-      return in ;
-   }
-   switch (ch) {
-     case '+' : break ;
-     case '-' : sign = -1 ; break ;
-     default  : in.putback(ch) ; break ;
-   }
-   // eat white
-   in >> std::ws  ;
-
-   int noend = 1 ;
-   while (noend)
-   {
-      counter = 0 ;
-
-      // Read 9 digits or less
-      while ((noend) && (counter < 9)) {
-         in.get(ch) ;
-         if (in.eof()) { noend = 0 ; }
-         else if ((ch >= '0') && (ch <= '9')) Tmp[counter++] = ch ;
-         else { noend = 0 ;  in.putback(ch) ; }
-      }
-      if (counter >0) {
-         long l ;
-         Tmp[counter] = '\0' ; // terminate the string
-         l = atol(Tmp) ;
-         a = a * base[counter-1] + l ;
-      }
-   }
-   if (sign == -1) a = -a ;
-   return in ;
-}
-
-}
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_lib.C b/src/kernel/gmp++/gmp++_int_lib.C
new file mode 100644
index 0000000..2df2d77
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_int_lib.C
@@ -0,0 +1,30 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_lib.C,v $
+// Copyright(c)'1994-2011 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B Boyer
+// $Id: gmp++_int_lib.C,v 1.4 2009-09-17 14:28:22 jgdumas Exp $
+// ==========================================================================
+/** @file gmp++/gmp++_int_lib.C
+ * libing stuff.
+ */
+
+
+#ifndef __GMPplusplus_LIB_C__
+#define __GMPplusplus_LIB_C__
+#include "gmp++/gmp++.h"
+namespace Givaro
+{
+	//------------------------------------- predefined null and one
+	const Integer Integer::zero(0UL);
+	const Integer Integer::one(1UL);
+	const Integer Integer::mOne(-1L);
+
+} // Givaro
+#endif
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
+
diff --git a/src/kernel/gmp++/gmp++_int_misc.C b/src/kernel/gmp++/gmp++_int_misc.C
index 12729d1..d67b195 100644
--- a/src/kernel/gmp++/gmp++_int_misc.C
+++ b/src/kernel/gmp++/gmp++_int_misc.C
@@ -9,284 +9,465 @@
 // $Id: gmp++_int_misc.C,v 1.16 2010-12-16 16:54:38 jgdumas Exp $
 // ==========================================================================
 // Description:
+/** @file gmp++/gmp++_int_misc.C
+ * miscing stuff.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_misc_C
+#define __GIVARO_gmpxx_gmpxx_int_misc_C
 
 #include <iostream>
 #include <math.h>
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#ifndef __GIVARO_GMP_NO_CXX
+#include <sstream>
+#endif
 
 namespace Givaro {
-//-------------------------------------------fact (unsigned long l)
-Integer fact ( unsigned long l)
-{
-  Integer Res ;
-  mpz_fac_ui( (mpz_ptr)&(Res.gmp_rep), l ) ;
-  return Res ;
-}
-
-//-------------------------------------------square root
-Integer& sqrt(Integer& q, const Integer &a)
-{
-  mpz_sqrt( (mpz_ptr)&(q.gmp_rep),
-              (mpz_srcptr)&(a.gmp_rep)) ;
-  return q;
-}
-
-Integer& sqrtrem(Integer& q, const Integer &a, Integer& r)
-{
-  mpz_sqrtrem( (mpz_ptr)&(q.gmp_rep),
-              (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(a.gmp_rep)) ;
-  return q;
-}
-
-Integer sqrt(const Integer &a)
-{
-  Integer q;
-  return sqrt(q,a);
-}
-
-Integer sqrtrem(const Integer &a, Integer& r)
-{
-  Integer q;
-  return sqrtrem(q,a,r);
-}
-
-bool root(Integer& q, const Integer &a, unsigned int n)
-{
-    return (bool)mpz_root ((mpz_ptr)&(q.gmp_rep),
-                           (mpz_srcptr)&(a.gmp_rep),
-                           n);
-}
-
-void swap(Integer& a, Integer& b) {
-    return mpz_swap( (mpz_ptr)&(a.gmp_rep), (mpz_ptr)&(b.gmp_rep));
-}
-
-
-// Natural logarithm of a
-// log(2) being close to 0.69314718055994531
-double naturallog(const Integer& a) {
-  signed long int exp;
-  double d = mpz_get_d_2exp( &exp, (mpz_srcptr)&(a.gmp_rep) );
-  return (double)exp*0.69314718055994531+log(d);
-}
-
-
-
-// base p logarithm of a
-long logp(const Integer& a, const Integer& p) {
-    std::list< Integer > pows;
-    Integer puiss = p, sq;
-    do {
-        pows.push_back( puiss );
-    } while ( (puiss *= puiss) <= a );
-    puiss = pows.back(); pows.pop_back();
-    long res = (1 << pows.size());
-    while (! pows.empty() ) {
-        if ((sq = puiss * pows.back()) <= a) {
-            puiss = sq;
-            pows.pop_back();
-            res += (1 << pows.size());
-        } else
-            pows.pop_back();
-    }
-    return res;
-}
-
-// approximation of the base 2 logarithm of a
-// 1/log(2) being close to 1.44269504088896341
-double logtwo(const Integer& a) {
-  signed long int exp;
-  double d = mpz_get_d_2exp( &exp, (mpz_srcptr)&(a.gmp_rep) );
-  return (double)exp+log(d)*1.44269504088896341;
-}
-
-//------------------------------------------GMP isprime
-//     If this function returns 0, OP is definitely not prime.  If it
-//     returns 1, then OP is `probably' prime.  The probability of a
-//     false positive is (1/4)^r.  A reasonable value of r is 25.
-
-Integer& nextprime(Integer& r, const Integer &p)
-{
-  mpz_nextprime ((mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep)) ;
-  return r;
-}
-
-// Copied and adapted from mpz/nextprime.c
-Integer& prevprime(Integer& r, const Integer &p)
-{
-   mpz_sub_ui ( (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep), 1L );
-   while( !mpz_probab_prime_p ( (mpz_srcptr)&(p.gmp_rep), 5 ) )
-   mpz_sub_ui ( (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep), 1L );
-   return r;
-}
-
-int probab_prime(const Integer &p)
-{
-  return mpz_probab_prime_p ((mpz_srcptr)&(p.gmp_rep),1) ;
-}
-
-int probab_prime(const Integer &p, int r)
-{
-  return mpz_probab_prime_p ((mpz_srcptr)&(p.gmp_rep),r) ;
-}
-
-// ==========================================================================
-// Computes and returns the Jacobi and Legendre symbols (u/v) of the integers u and v.
-// The algorithm used is Gmp's.
-int jacobi(const Integer& u, const Integer& v)
-{
-  return mpz_jacobi ((mpz_srcptr)&(u.gmp_rep),(mpz_srcptr)&(v.gmp_rep)) ;
-}
-
-int legendre(const Integer& u, const Integer& v)
-{
-  return mpz_legendre ((mpz_srcptr)&(u.gmp_rep),(mpz_srcptr)&(v.gmp_rep)) ;
-}
-
-
-
-//--------------------------------------------Integer::operator <<   // shift left
-Integer Integer::operator << (int l) const
-{ return this->operator<<( (unsigned long)l ); }
-Integer Integer::operator << (unsigned int l) const
-{ return this->operator<<( (unsigned long)l ); }
-Integer Integer::operator << (long l) const
-{ return this->operator<<( (unsigned long)l ); }
-
-Integer Integer::operator << (unsigned long l) const
-{
-	Integer tmp;
-	mpz_mul_2exp((mpz_ptr)&(tmp.gmp_rep), (mpz_srcptr)&(gmp_rep), l );
-	return tmp;
-}
-
-
-//--------------------------------------------Integer::operator >>   // shift right
-Integer Integer::operator >> (int l) const
-{ return this->operator>>( (unsigned long)l ); }
-
-Integer Integer::operator >> (long l) const
-{ return this->operator>>( (unsigned long)l ); }
-
-Integer Integer::operator >> (unsigned int l) const
-{ return this->operator>>( (unsigned long)l ); }
-
-Integer Integer::operator >> (unsigned long l) const
-{
-	Integer tmp;
-	mpz_tdiv_q_2exp( (mpz_ptr)&(tmp.gmp_rep), (mpz_srcptr)&(gmp_rep), l );
-	return tmp;
-}
-
-//--------------------------------------------Integer::operator <<=   // shift left
-Integer& Integer::operator <<= (int l)
-{ return this->operator<<= ( (unsigned long)l ); }
-Integer& Integer::operator <<=  (unsigned int l)
-{ return this->operator<<= ( (unsigned long)l ); }
-Integer& Integer::operator <<= (long l)
-{ return this->operator<<= ( (unsigned long)l ); }
-
-Integer& Integer::operator <<= (unsigned long l)
-{
-	mpz_mul_2exp((mpz_ptr)&(gmp_rep), (mpz_srcptr)&(gmp_rep), l );
-	return *this;
-}
-
+	//-------------------------------------------fact (long unsigned int l)
+	Integer fact ( long unsigned int l)
+	{
+		Integer Res ;
+		mpz_fac_ui( (mpz_ptr)&(Res.gmp_rep), l ) ;
+		return Res ;
+	}
+
+	//-------------------------------------------square root
+	Integer& sqrt(Integer& q, const Integer &a)
+	{
+		mpz_sqrt( (mpz_ptr)&(q.gmp_rep),
+			  (mpz_srcptr)&(a.gmp_rep)) ;
+		return q;
+	}
+
+	Integer& sqrtrem(Integer& q, const Integer &a, Integer& r)
+	{
+		mpz_sqrtrem( (mpz_ptr)&(q.gmp_rep),
+			     (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(a.gmp_rep)) ;
+		return q;
+	}
+
+	Integer sqrt(const Integer &a)
+	{
+		Integer q;
+		return sqrt(q,a);
+	}
+
+	Integer sqrtrem(const Integer &a, Integer& r)
+	{
+		Integer q;
+		return sqrtrem(q,a,r);
+	}
+
+	bool root(Integer& q, const Integer &a, unsigned int n)
+	{
+		return (bool)mpz_root ((mpz_ptr)&(q.gmp_rep),
+				       (mpz_srcptr)&(a.gmp_rep),
+				       n);
+	}
+
+	void swap(Integer& a, Integer& b)
+	{
+		return mpz_swap( (mpz_ptr)&(a.gmp_rep), (mpz_ptr)&(b.gmp_rep));
+	}
+
+
+	// Natural logarithm of a
+	// log(2) being close to 0.69314718055994531
+	double naturallog(const Integer& a)
+	{
+		signed long int exp_;
+		double d = mpz_get_d_2exp( &exp_, (mpz_srcptr)&(a.gmp_rep) );
+		return (double)exp_*0.69314718055994531+log(d);
+	}
+
+
+
+	// base p logarithm of a
+	long logp(const Integer& a, const Integer& p)
+	{
+		std::list< Integer > pows;
+		Integer puiss = p, sq;
+		do {
+			pows.push_back( puiss );
+		} while ( (puiss *= puiss) <= a );
+		puiss = pows.back(); pows.pop_back();
+		long res = (1 << pows.size());
+		while (! pows.empty() ) {
+			if ((sq = puiss * pows.back()) <= a) {
+				puiss = sq;
+				pows.pop_back();
+				res += (1 << pows.size());
+			} else
+				pows.pop_back();
+		}
+		return res;
+	}
+
+	// approximation of the base 2 logarithm of a
+	// 1/log(2) being close to 1.44269504088896341
+	double logtwo(const Integer& a)
+	{
+		signed long int exp;
+		double d = mpz_get_d_2exp( &exp, (mpz_srcptr)&(a.gmp_rep) );
+		return (double)exp+log(d)*1.44269504088896341;
+	}
+
+	//------------------------------------------GMP isprime
+	//     If this function returns 0, OP is definitely not prime.  If it
+	//     returns 1, then OP is `probably' prime.  The probability of a
+	//     false positive is (1/4)^r.  A reasonable value of r is 25.
+
+	Integer& nextprime(Integer& r, const Integer &p)
+	{
+		mpz_nextprime ((mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep)) ;
+		return r;
+	}
+
+	// Copied and adapted from mpz/nextprime.c
+	Integer& prevprime(Integer& r, const Integer &p)
+	{
+		mpz_sub_ui ( (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep), 1L );
+		while( !mpz_probab_prime_p ( (mpz_srcptr)&(p.gmp_rep), 5 ) )
+			mpz_sub_ui ( (mpz_ptr)&(r.gmp_rep), (mpz_srcptr)&(p.gmp_rep), 1L );
+		return r;
+	}
+
+	int probab_prime(const Integer &p)
+	{
+		return mpz_probab_prime_p ((mpz_srcptr)&(p.gmp_rep),1) ;
+	}
+
+	int probab_prime(const Integer &p, int r)
+	{
+		return mpz_probab_prime_p ((mpz_srcptr)&(p.gmp_rep),r) ;
+	}
+
+	// ==========================================================================
+	// Computes and returns the Jacobi and Legendre symbols (u/v) of the integers u and v.
+	// The algorithm used is Gmp's.
+	int jacobi(const Integer& u, const Integer& v)
+	{
+		return mpz_jacobi ((mpz_srcptr)&(u.gmp_rep),(mpz_srcptr)&(v.gmp_rep)) ;
+	}
+
+	int legendre(const Integer& u, const Integer& v)
+	{
+		return mpz_legendre ((mpz_srcptr)&(u.gmp_rep),(mpz_srcptr)&(v.gmp_rep)) ;
+	}
+
+
+
+	//--------------------------------------------Integer::operator <<   // shift left
+	Integer Integer::operator << (int l) const
+	{
+		return this->operator<<( (long unsigned)l );
+	}
+	Integer Integer::operator << (unsigned int l) const
+	{
+		return this->operator<<( (long unsigned)l );
+	}
+	Integer Integer::operator << (long int l) const
+	{
+		return this->operator<<( (long unsigned)l );
+	}
+
+	Integer Integer::operator << (long unsigned int l) const
+	{
+		Integer tmp;
+		mpz_mul_2exp((mpz_ptr)&(tmp.gmp_rep), (mpz_srcptr)&(gmp_rep), l );
+		return tmp;
+	}
+
+
+	//--------------------------------------------Integer::operator >>   // shift right
+	Integer Integer::operator >> (int l) const
+	{
+		return this->operator>>( (long unsigned)l );
+	}
+
+	Integer Integer::operator >> (long int l) const
+	{
+		return this->operator>>( (long unsigned)l );
+	}
+
+	Integer Integer::operator >> (unsigned int l) const
+	{
+		return this->operator>>( (long unsigned)l );
+	}
+
+	Integer Integer::operator >> (long unsigned int l) const
+	{
+		Integer tmp;
+		mpz_tdiv_q_2exp( (mpz_ptr)&(tmp.gmp_rep), (mpz_srcptr)&(gmp_rep), l );
+		return tmp;
+	}
+
+	//--------------------------------------------Integer::operator <<=   // shift left
+	Integer& Integer::operator <<= (int l)
+	{
+		return this->operator<<= ( (long unsigned)l );
+	}
+	Integer& Integer::operator <<=  (unsigned int l)
+	{
+		return this->operator<<= ( (long unsigned)l );
+	}
+	Integer& Integer::operator <<= (long int l)
+	{
+		return this->operator<<= ( (long unsigned)l );
+	}
+
+	Integer& Integer::operator <<= (long unsigned int l)
+	{
+		mpz_mul_2exp((mpz_ptr)&(gmp_rep), (mpz_srcptr)&(gmp_rep), l );
+		return *this;
+	}
+
+
+	//--------------------------------------------Integer::operator >>=   // shift right
+	Integer& Integer::operator >>= (int l)
+	{
+		return this->operator>>= ( (long unsigned)l );
+	}
+	Integer& Integer::operator >>= (long int l)
+	{
+		return this->operator>>= ( (long unsigned)l );
+	}
+	Integer& Integer::operator >>= (unsigned int l)
+	{
+		return this->operator>>= ( (long unsigned)l );
+	}
+
+	Integer& Integer::operator >>= (long unsigned int l)
+	{
+		mpz_tdiv_q_2exp( (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(gmp_rep), l );
+		return *this;
+	}
+
+	//------------------------------------------- Bit logic
+	Integer Integer::operator^ (const Integer& a) const
+	{   // XOR
+		Integer res(*this);
+		return res ^= a;
+	}
+	Integer Integer::operator| (const Integer& a) const
+	{   // OR
+		Integer res(*this);
+		return res |= a;
+	}
+	Integer Integer::operator& (const Integer& a) const
+	{   // AND
+		Integer res(*this);
+		return res &= a;
+	}
+	Integer Integer::operator^ (const long unsigned int & a) const
+	{   // XOR
+		Integer res(*this);
+		return res ^= a;
+	}
+	Integer Integer::operator| (const long unsigned int & a) const
+	{   // OR
+		Integer res(*this);
+		return res |= a;
+	}
+	long unsigned Integer::operator& (const long unsigned int & a) const
+	{   // AND
+		return mpz_get_ui((mpz_srcptr)&(gmp_rep)) & a;
+	}
+	Integer Integer::operator^ (const unsigned int& a) const
+	{   // XOR
+		Integer res(*this);
+		return res ^= a;
+	}
+	Integer Integer::operator| (const unsigned int& a) const
+	{   // OR
+		Integer res(*this);
+		return res |= a;
+	}
+	unsigned int Integer::operator& (const unsigned int& a) const
+	{   // AND
+		return (unsigned int) (mpz_get_ui((mpz_srcptr)&(gmp_rep)) & (long unsigned int)a );
+	}
+	Integer Integer::operator~ () const
+	{   // 1 complement
+		Integer res;
+		mpz_com( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&(gmp_rep));
+		return res;
+	}
+	Integer& Integer::operator^= (const Integer& a)
+	{   // XOR
+		mpz_xor( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator|= (const Integer& a)
+	{   // OR
+		mpz_ior( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator&= (const Integer& a)
+	{   // AND
+		mpz_and( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
+		return *this;
+	}
+
+	Integer& Integer::operator^= (const long unsigned int & a)
+	{   // XOR
+        Integer au(a);
+		mpz_xor( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator|= (const long unsigned int & a)
+	{   // OR
+        Integer au(a);
+		mpz_ior( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator&= (const long unsigned int & a)
+	{   // AND
+        Integer au(a);
+		mpz_and( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+
+	Integer& Integer::operator^= (const unsigned int& a)
+	{   // XOR
+        Integer au(a);
+		mpz_xor( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator|= (const unsigned int& a)
+	{   // OR
+        Integer au(a);
+		mpz_ior( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+	Integer& Integer::operator&= (const unsigned int& a)
+	{   // AND
+        Integer au(a);
+		mpz_and( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(au.gmp_rep));
+		return *this;
+	}
+
+
+	//------------------------------------------- convert method
+	//------------------------------------------- casting method
+	Integer::operator int() const
+	{
+		return int (mpz_get_si ( (mpz_srcptr)&gmp_rep));
+	}
+	Integer::operator unsigned int() const
+	{
+		return (unsigned int) mpz_get_ui ( (mpz_srcptr)&gmp_rep);
+	}
+	Integer::operator long() const
+	{
+		return mpz_get_si ( (mpz_srcptr)&gmp_rep);
+	}
+	Integer::operator long unsigned() const
+	{
+		return mpz_get_ui ( (mpz_srcptr)&gmp_rep);
+	}
+#ifdef __USE_64_bits__
+	Integer::operator long long unsigned() const
+	{
+		long unsigned int low = (long unsigned)(*this);
+		Integer rem;
+		short cbtuli = CHAR_BIT*sizeof(long unsigned int);
+		mpz_tdiv_q_2exp( (mpz_ptr)&(rem.gmp_rep), (mpz_srcptr)&(gmp_rep), cbtuli );
+		long long unsigned tmp = (long unsigned)(rem);
+		//	tmp <<= CHAR_BIT*sizeof(long unsigned int) ;
+		cbtuli /= 2;
+		tmp <<= cbtuli ;
+		tmp <<= cbtuli ;
+
+		return tmp |= low;
+	}
+	Integer::operator long long() const
+	{
+		long long unsigned toto = (long long unsigned)(*this);
+		long long tmp = (long long) toto ;
+//                 if (*this < 0) tmp = -tmp;
+//                 return tmp;
+		return ((*this)<0)? -tmp: tmp;
+	}
+#endif
 
-//--------------------------------------------Integer::operator >>=   // shift right
-Integer& Integer::operator >>= (int l)
-{ return this->operator>>= ( (unsigned long)l ); }
-Integer& Integer::operator >>= (long l)
-{ return this->operator>>= ( (unsigned long)l ); }
-Integer& Integer::operator >>= (unsigned int l)
-{ return this->operator>>= ( (unsigned long)l ); }
+	Integer::operator double() const
+	{
+		return mpz_get_d ( (mpz_srcptr)&gmp_rep);
+	}
+	Integer::operator float() const
+	{
+		return (float)mpz_get_d ( (mpz_srcptr)&gmp_rep);
+	}
+
+	Integer::operator std::string () const
+	{
+#ifdef __GIVARO_GMP_NO_CXX
+		std::string s;
+		long unsigned strSize = mpz_sizeinbase((mpz_srcptr)&(gmp_rep), 10) + 2;
+		char *str = new char[strSize + 2];
+		mpz_get_str(str, 10, (mpz_srcptr)&(gmp_rep));
+		s = std::string(str);
+		delete [] str ;
+		// return ??
+#else
+		std::ostringstream o ;
+		print(o);
+		return o.str();
+#endif
+	}
+
+	Integer::operator Integer::vect_t () const
+	{
+		size_t s = mpz_size( (mpz_srcptr)&(gmp_rep) );
+		std::vector<mp_limb_t> v(s);
+		std::vector<mp_limb_t>::iterator vi = v.begin();
+		for(mp_size_t i = 0;vi != v.end();++vi, ++i)
+			*vi = mpz_getlimbn( (mpz_srcptr)& (gmp_rep) ,i);
+		return v;
+	}
+
+	long unsigned int length(const Integer& a)
+	{
+            // JGD 23.04.2012: shouldn't it be "mp_limb_t" instead of "long unsigned"?
+		return mpz_size( (mpz_srcptr)&(a.gmp_rep) ) * sizeof(long unsigned);
+	}
+
+	Integer abs(const Integer &n)
+	{
+		if (sign(n) >= 0)
+			return n;
+		return -n;
+	}
+
+	size_t Integer::size() const
+	{
+		return  mpz_size( (mpz_srcptr)&gmp_rep ) ;
+	}
+
+	size_t Integer::size_in_base(int BASE) const
+	{
+		return  mpz_sizeinbase ((mpz_srcptr)&gmp_rep, BASE);
+	}
+
+	size_t Integer::bitsize() const
+	{
+		return  mpz_sizeinbase ((mpz_srcptr)&gmp_rep, 2);
+	}
+
+	long unsigned Integer::operator[](size_t i) const
+	{
+		if ( mpz_size( (mpz_srcptr)&gmp_rep ) > i)
+			return mpz_getlimbn( (mpz_srcptr)&gmp_rep, i);
+		else
+			return 0;
+	}
 
-Integer& Integer::operator >>= (unsigned long l)
-{
-	mpz_tdiv_q_2exp( (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(gmp_rep), l );
-	return *this;
 }
 
-//------------------------------------------- Bit logic
-    Integer Integer::operator^ (const Integer& a) const {   // XOR
-        Integer res(*this);
-        return res ^= a;
-    }
-    Integer Integer::operator| (const Integer& a) const {   // OR
-        Integer res(*this);
-        return res |= a;
-    }
-    Integer Integer::operator& (const Integer& a) const {   // AND
-        Integer res(*this);
-        return res &= a;
-    }
-    unsigned long Integer::operator^ (const unsigned long& a) const {   // XOR
-        return mpz_get_ui((mpz_srcptr)&(gmp_rep)) ^ a;
-    }
-    unsigned long Integer::operator| (const unsigned long& a) const {   // OR
-        return mpz_get_ui((mpz_srcptr)&(gmp_rep)) | a;
-    }
-    unsigned long Integer::operator& (const unsigned long& a) const {   // AND
-        return mpz_get_ui((mpz_srcptr)&(gmp_rep)) & a;
-    }
-    Integer Integer::operator~ () const {   // 1 complement
-        Integer res;
-        mpz_com( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&(gmp_rep));
-        return res;
-    }
-    Integer& Integer::operator^= (const Integer& a) {   // XOR
-        mpz_xor( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
-        return *this;
-    }
-    Integer& Integer::operator|= (const Integer& a) {   // OR
-        mpz_ior( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
-        return *this;
-    }
-    Integer& Integer::operator&= (const Integer& a) {   // AND
-        mpz_and( (mpz_ptr)&(gmp_rep), (mpz_ptr)&(gmp_rep), (mpz_srcptr)&(a.gmp_rep));
-        return *this;
-    }
-
-
-//------------------------------------------- convert method
-//------------------------------------------- casting method
-Integer::operator int() const {
-	return int (mpz_get_si ( (mpz_srcptr)&gmp_rep));
-}
-Integer::operator unsigned int() const {
-	return (unsigned int) mpz_get_ui ( (mpz_srcptr)&gmp_rep);
-}
-Integer::operator long() const {
-	return mpz_get_si ( (mpz_srcptr)&gmp_rep);
-}
-Integer::operator unsigned long() const {
-	return mpz_get_ui ( (mpz_srcptr)&gmp_rep);
-}
-#ifdef __USE_64_bits__
-Integer::operator unsigned long long() const {
-	unsigned long low = (unsigned long)(*this);
-	Integer rem;
-	short cbtuli = CHAR_BIT*sizeof(unsigned long int);
-	mpz_tdiv_q_2exp( (mpz_ptr)&(rem.gmp_rep), (mpz_srcptr)&(gmp_rep), cbtuli );
-	unsigned long high = (unsigned long)(rem);
-	unsigned long long tmp = high;
-//	tmp <<= CHAR_BIT*sizeof(unsigned long int) ;
-	cbtuli = short (cbtuli >> 1);
-	tmp <<= cbtuli ;
-        tmp <<= cbtuli ;
-
-	return tmp += low;
-}
-Integer::operator long long() const {
-	unsigned long long tmp = (unsigned long long)(*this);
-	return (long long)tmp;
-}
-#endif
+#endif // __GIVARO_gmpxx_gmpxx_int_misc_C
 
-Integer::operator double() const {
-	return mpz_get_d ( (mpz_srcptr)&gmp_rep);
-}
-Integer::operator float() const {
-	return (float)mpz_get_d ( (mpz_srcptr)&gmp_rep);
-}
-}
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_mod.C b/src/kernel/gmp++/gmp++_int_mod.C
index 9a425f8..15b4fb9 100644
--- a/src/kernel/gmp++/gmp++_int_mod.C
+++ b/src/kernel/gmp++/gmp++_int_mod.C
@@ -9,8 +9,17 @@
 // Modified: JG. Dumas, BB.
 // $Id: gmp++_int_mod.C,v 1.17 2010-12-22 13:47:45 jgdumas Exp $
 // ==========================================================================
+/** @file gmp++/gmp++_int_mod.C
+ * moding stuff.
+ */
 
+#ifndef __GIVARO_gmpxx_gmpxx_int_mod_C
+#define __GIVARO_gmpxx_gmpxx_int_mod_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#include <cstdlib>
 
 #ifndef GIVABS
 #define GIVABS(a) ((a)>0?(a):-(a))
@@ -25,18 +34,18 @@ namespace Givaro {
 		mpz_mod( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
 		return res;
 	}
-	Integer& Integer::modin(Integer& res, const unsigned long n)
+	Integer& Integer::modin(Integer& res, const long unsigned int n)
 	{
 		if (isZero(res)) return res;
 		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
 		mpz_mod_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
 		return res;
 	}
-	Integer& Integer::modin(Integer& res, const long n)
+	Integer& Integer::modin(Integer& res, const long int n)
 	{
 		if (isZero(res)) return res;
-		// int sgn = GMP__SGN(n);
-		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, GMP__ABS(n));
+		// int sgn = sign(n);
+		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, abs(n));
 		// if (sgn <0) return res = -res;
 
 		if (n>0)
@@ -53,14 +62,14 @@ namespace Givaro {
 		if (isZero(n1)) return res = Integer::zero;
 		// mpz_tdiv_r( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, (mpz_ptr)&n2.gmp_rep);
 		mpz_mod( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
-		assert(!(res<0) && (res<GMP__ABS(n2)));
+		assert(!(res<0) && (res<abs(n2)));
 		return res;
 	}
-	Integer& Integer::mod(Integer& res, const Integer& n1, const long n2)
+	Integer& Integer::mod(Integer& res, const Integer& n1, const long int n2)
 	{
 		if (isZero(n1)) return res = Integer::zero;
-		// int sgn = GMP__SGN(n2);
-		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, GMP__ABS(n2));
+		// int sgn = sign(n2);
+		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, abs(n2));
 		// if (sgn <0) return res = - res;
 
 		if (n2>0)
@@ -68,10 +77,10 @@ namespace Givaro {
 		else
 			mpz_mod_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&n1.gmp_rep, -n2);
 
-		assert(!(res<0) && (res<GMP__ABS(n2)));
+		assert(!(res<0) && (res<std::abs(n2)));
 		return res;
 	}
-	Integer& Integer::mod(Integer& res, const Integer& n1, const unsigned long n2)
+	Integer& Integer::mod(Integer& res, const Integer& n1, const long unsigned int n2)
 	{
 		if (isZero(n1)) return res = Integer::zero;
 		// mpz_tdiv_r_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, n2);
@@ -89,7 +98,7 @@ namespace Givaro {
 		return *this;
 	}
 
-	Integer& Integer::operator %= (const unsigned long l)
+	Integer& Integer::operator %= (const long unsigned int l)
 	{
 		if (isZero(*this)) return *this;
 #ifdef DEBUG
@@ -105,14 +114,14 @@ namespace Givaro {
 		return *this;
 	}
 
-	Integer& Integer::operator %= (const long l)
+	Integer& Integer::operator %= (const long int l)
 	{
 		if (isZero(*this)) return *this;
 #ifdef DEBUG
 		int sgn_this = (*this>0)?1:-1;
 #endif
-		int sgn = GMP__SGN(l);
-		mpz_tdiv_r_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, GMP__ABS(l));
+		int sgn = Givaro::sign(l);
+		mpz_tdiv_r_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, std::abs(l));
 		if (sgn <0) mpz_neg( (mpz_ptr)&gmp_rep, (mpz_ptr)&(gmp_rep) );
 
 #ifdef DEBUG
@@ -132,7 +141,7 @@ namespace Givaro {
 		return res;
 	}
 
-	long Integer::operator % (const unsigned long l) const
+	long Integer::operator % (const long unsigned int l) const
 	{
 #if 0
 		if (isZero(*this)) return 0UL;
@@ -141,7 +150,7 @@ namespace Givaro {
 		else {
 			Integer Neg;
 			mpz_neg( (mpz_ptr)&(Neg.gmp_rep), (mpz_ptr)&gmp_rep );
-			unsigned long res = mpz_tdiv_ui( (mpz_ptr)&(Neg.gmp_rep), l);
+			long unsigned res = mpz_tdiv_ui( (mpz_ptr)&(Neg.gmp_rep), l);
 			if (res > 0UL) return (l-res);
 			else return 0UL;
 		}
@@ -150,7 +159,7 @@ namespace Givaro {
 		if (isZero(*this)) return 0UL;
 		bool isneg = (*this)<0 ;
 		//CONDITION: mpz_tdiv_ui does NOT consider the sign of gmp_rep
-		unsigned long res = mpz_tdiv_ui( (mpz_srcptr)&gmp_rep, l);
+		long unsigned res = mpz_tdiv_ui( (mpz_srcptr)&gmp_rep, l);
 #ifdef DEBUG
 		Integer toto = res;
 		if (isneg) toto = -(long)res ;
@@ -158,14 +167,15 @@ namespace Givaro {
 		// std::cout << toto << ',' << l << ',' << ',' << *this << std::endl;
 		assert((toto<l) && (-toto<l) && (toto.priv_sign()*(*this).priv_sign()>=0)) ;
 #endif
-		if (!res) return res ;
+		if (!res)
+			return (long)res ;
 		if (isneg) return (-(long)res) ;
 
 
-		return res ;
+		return (long)res ;
 	}
 
-	long Integer::operator % (const long l) const
+	long Integer::operator % (const long int l) const
 	{
 #if 0
 		if (l ==0) {
@@ -174,10 +184,10 @@ namespace Givaro {
 #endif
 		long res ;
 		if (l>0) {
-			res = static_cast<long>(this->operator%( static_cast<unsigned long>(l) ) );
+			res = static_cast<long>(this->operator%( static_cast<long unsigned>(l) ) );
 		}
 		else {
-			res = static_cast<long>(this->operator%( static_cast<unsigned long>( -l ) ) );
+			res = static_cast<long>(this->operator%( static_cast<long unsigned>( -l ) ) );
 		}
 
 		// std::cout << res << ',' << l << ',' << *this << std::endl;
@@ -189,26 +199,26 @@ namespace Givaro {
 	{
 		double res ;
 		if (l>0)
-			res =  static_cast<double>(this->operator%( static_cast<unsigned long>(l) ) );
+			res =  static_cast<double>(this->operator%( static_cast<long unsigned>(l) ) );
 		else{
-			res =  static_cast<double>(this->operator%( static_cast<unsigned long>(-l) ) );
+			res =  static_cast<double>(this->operator%( static_cast<long unsigned>(-l) ) );
 		}
 		assert((res<GIVABS(l)) && (res> -GIVABS(l)) && (((res>0)?1:((res==0)?0:-1))*(*this).priv_sign()>=0)) ;
 		return res;
 	}
 
 	//Added by Dan Roche, 6-28-04
-#ifdef __USE_64_bits__
-	unsigned long long Integer::operator % (const unsigned long long l) const
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	long long unsigned Integer::operator % (const long long unsigned int l) const
 	{
 		if (isZero(*this)) return 0LL;
 		Integer Res(Integer::one);
 		Integer Divisor(l);
 		mpz_tdiv_r( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_ptr)&(Divisor.gmp_rep) );
-		return (unsigned long long)( Res );
+		return (long long unsigned)( Res );
 	}
 
-	long long Integer::operator % (const long long l) const
+	long long Integer::operator % (const long long int l) const
 	{
 		if (isZero(*this)) return 0LL;
 		Integer Res(Integer::one);
@@ -218,6 +228,37 @@ namespace Givaro {
 	}
 #endif //__USE_64_bits__
 
+	// -- operator %
+	 Integer operator % (const int l, const Integer& n)
+	{
+		return Integer(l) % n;
+	}
+	 Integer operator % (const long int l, const Integer& n)
+	{
+		return Integer(l) % n;
+	}
+	 Integer operator % (const Integer& n, const int l)
+	{
+		return n % (long)l;
+	}
+	 Integer operator % (const Integer& n, const unsigned int l)
+	{
+		return n % (long unsigned)l;
+	}
+
+	 Integer& operator %= (Integer& n, const int l)
+	{
+		return n %= (long)l;
+	}
+	 Integer& operator %= (Integer& n, const unsigned int l)
+	{
+		return n %= (long unsigned)l;
+	}
+
+
 }
+
+
+#endif // __GIVARO_gmpxx_gmpxx_int_mod_C
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen:foldmethod=syntax
diff --git a/src/kernel/gmp++/gmp++_int_mul.C b/src/kernel/gmp++/gmp++_int_mul.C
index fdcc18c..f1a5d42 100644
--- a/src/kernel/gmp++/gmp++_int_mul.C
+++ b/src/kernel/gmp++/gmp++_int_mul.C
@@ -8,8 +8,16 @@
 // Authors: M. Samama, T. Gautier
 // $Id: gmp++_int_mul.C,v 1.11 2011-01-20 08:19:15 jgdumas Exp $
 // ==========================================================================
+/** @file gmp++/gmp++_int_mul.C
+ * muling stuff.
+ */
 
+#ifndef __GIVARO_gmpxx_gmpxx_int_mul_C
+#define __GIVARO_gmpxx_gmpxx_int_mul_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
 
 namespace Givaro {
 
@@ -21,19 +29,19 @@ Integer& Integer::mulin(Integer& res, const Integer& n)
   mpz_mul( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
   return res;
 }
-Integer& Integer::mulin(Integer& res, const long n)
+Integer& Integer::mulin(Integer& res, const long int n)
 {
   if (isZero(n)) return res = Integer::zero;
   if (isZero(res)) return res;
-//   int sgn = GMP__SGN(n);
-  // int sgn = GMP__SGN(n);
-  // mpz_mul_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, GMP__ABS(n));
+//   int sgn = sign(n);
+  // int sgn = sign(n);
+  // mpz_mul_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, abs(n));
 //   if (sgn <0) res.gmp_rep.size = -res.gmp_rep.size;
   // if (sgn <0) return res = -res;
   mpz_mul_si( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
   return res;
 }
-Integer& Integer::mulin(Integer& res, const unsigned long n)
+Integer& Integer::mulin(Integer& res, const long unsigned int n)
 {
   if (isZero(n)) return res = Integer::zero;
   if (isZero(res)) return res;
@@ -48,18 +56,18 @@ Integer& Integer::mul(Integer& res, const Integer& n1, const Integer& n2)
   mpz_mul( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
   return res;
 }
-Integer& Integer::mul(Integer& res, const Integer& n1, const long n2)
+Integer& Integer::mul(Integer& res, const Integer& n1, const long int n2)
 {
   if (isZero(n1)) return res = Integer::zero;
   if (isZero(n2)) return res = Integer::zero;
-  // int sgn = GMP__SGN(n2);
-  // mpz_mul_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, GMP__ABS(n2));
+  // int sgn = sign(n2);
+  // mpz_mul_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&n1.gmp_rep, abs(n2));
   // if (sgn <0) res.gmp_rep.size = -res.gmp_rep.size;
   // if (sgn <0) return res = -res;
   mpz_mul_si( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
   return res;
 }
-Integer& Integer::mul(Integer& res, const Integer& n1, const unsigned long n2)
+Integer& Integer::mul(Integer& res, const Integer& n1, const long unsigned int n2)
 {
   if (isZero(n1)) return res = Integer::zero;
   if (isZero(n2)) return res = Integer::zero;
@@ -76,7 +84,7 @@ Integer& Integer::axpy(Integer& res, const Integer& a, const Integer& x, const I
     return res;
 }
 
-Integer& Integer::axpy(Integer& res, const Integer& a, const long unsigned x, const Integer& b)
+Integer& Integer::axpy(Integer& res, const Integer& a, const long unsigned int x, const Integer& b)
 {
     if (&res == &b) return Integer::axpyin(res,a,x);
     if (isZero(a) || isZero(x)) return res = b;
@@ -93,7 +101,7 @@ Integer& Integer::axpyin(Integer& res, const Integer& a, const Integer& x)
     return res;
 }
 
-Integer& Integer::axpyin(Integer& res, const Integer& a, const long unsigned x)
+Integer& Integer::axpyin(Integer& res, const Integer& a, const long unsigned int x)
 {
     if (isZero(a) || isZero(x)) return res;
     mpz_addmul_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&a.gmp_rep, x);
@@ -109,7 +117,7 @@ Integer& Integer::maxpy(Integer& res, const Integer& a, const Integer& x, const
     mpz_sub( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&b.gmp_rep, (mpz_ptr)&res.gmp_rep);
 	return res;
 }
-Integer& Integer::maxpy(Integer& res, const Integer& a, const long unsigned x, const Integer& b)
+Integer& Integer::maxpy(Integer& res, const Integer& a, const long unsigned int x, const Integer& b)
 {
     if (isZero(a) || isZero(x)) return res=b;
     if (&res == &b) return Integer::maxpyin(res,a,x);
@@ -127,7 +135,7 @@ Integer& Integer::axmy(Integer& res, const Integer& a, const Integer& x, const I
     return res;
 }
 
-Integer& Integer::axmy(Integer& res, const Integer& a, const long unsigned x, const Integer& b)
+Integer& Integer::axmy(Integer& res, const Integer& a, const long unsigned int x, const Integer& b)
 {
     if (&res == &b) return Integer::axmyin(res,a,x);
     if (isZero(a) || isZero(x)) return Integer::neg(res,b);
@@ -143,7 +151,7 @@ Integer& Integer::axmyin(Integer& res, const Integer& a, const Integer& x)
 	return res ;
 }
 
-Integer& Integer::axmyin(Integer& res, const Integer& a, const unsigned long x)
+Integer& Integer::axmyin(Integer& res, const Integer& a, const long unsigned int x)
 {
 	Integer::maxpyin(res,a,x);
 	Integer::negin(res);
@@ -157,7 +165,7 @@ Integer& Integer::maxpyin(Integer& res, const Integer& a, const Integer& x)
     return res;
 }
 
-Integer& Integer::maxpyin(Integer& res, const Integer& a, const unsigned long x)
+Integer& Integer::maxpyin(Integer& res, const Integer& a, const long unsigned int x)
 {
     if (isZero(a) || isZero(x)) return res;
     mpz_submul_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&a.gmp_rep, x);
@@ -174,7 +182,7 @@ Integer& Integer::operator *= (const Integer& n)
   return *this = res;
 }
 
-Integer& Integer::operator *= (const unsigned long l)
+Integer& Integer::operator *= (const long unsigned int l)
 {
   if (l==0) return *this = Integer::zero;
   if (isZero(*this)) return *this;
@@ -183,13 +191,13 @@ Integer& Integer::operator *= (const unsigned long l)
   return *this;
 }
 
-Integer& Integer::operator *= (const long l)
+Integer& Integer::operator *= (const long int l)
 {
   if (l==0) return *this =Integer::zero;
   if (isZero(*this)) return *this;
 //   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
-  // int sgn = GMP__SGN(l);
-  // mpz_mul_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, GMP__ABS(l));
+  // int sgn = sign(l);
+  // mpz_mul_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, abs(l));
   // if (sgn <0) mpz_neg( (mpz_ptr)&gmp_rep, (mpz_ptr)&(gmp_rep) );
   mpz_mul_si( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
   return *this;
@@ -206,7 +214,7 @@ Integer Integer::operator * (const Integer& n) const
   return res;
 }
 
-Integer Integer::operator * (const unsigned long l) const
+Integer Integer::operator * (const long unsigned int l) const
 {
   if (l==0) return Integer::zero;
   if (isZero(*this)) return Integer::zero;
@@ -216,14 +224,14 @@ Integer Integer::operator * (const unsigned long l) const
   return res;
 }
 
-Integer Integer::operator * (const long l) const
+Integer Integer::operator * (const long int l) const
 {
   if (l==0) return Integer::zero;
   if (isZero(*this)) return Integer::zero;
 //   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
   Integer res;
-  // int sgn = GMP__SGN(l);
-  // mpz_mul_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, GMP__ABS(l));
+  // int sgn = sign(l);
+  // mpz_mul_ui( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&gmp_rep, abs(l));
 //   if (sgn <0) (res.gmp_rep).size = -(res.gmp_rep).size;
 //   return Integer((res.gmp_rep));
   // if (sgn <0) mpz_neg( (mpz_ptr)&(res.gmp_rep), (mpz_ptr)&(res.gmp_rep) );
@@ -231,6 +239,69 @@ Integer Integer::operator * (const long l) const
   return res;
 }
 
-}
+	// -- operator *
+	 Integer operator * (const int l, const Integer& n)
+	{
+		return n * (long)l;
+	}
+	 Integer operator * (const unsigned int l, const Integer& n)
+	{
+		return n * (long unsigned)l;
+	}
+	 Integer operator * (const long int l, const Integer& n)
+	{
+		return n * l;
+	}
+	 Integer operator * (const long unsigned int l, const Integer& n)
+	{
+		return n * l;
+	}
+	 Integer operator * (const Integer& n, const int l)
+	{
+		return n * (long)l;
+	}
+	 Integer operator * (const Integer& n, const unsigned int l)
+	{
+		return n * (long unsigned)l;
+	}
+
+	 Integer& operator *= (Integer& n, const int l)
+	{
+		return n *= (long)l;
+	}
+	 Integer& operator *= (Integer& n, const unsigned int l)
+	{
+		return n *= (long unsigned)l;
+	}
 
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	 Integer operator * (const Integer& n, const long long int l)
+	{
+		return n * (Integer)l;
+	}
+	 Integer operator * (const Integer& n, const long long unsigned int l)
+	{
+		return n * (Integer)l;
+	}
+	 Integer operator * (const long long int l, const Integer& n)
+	{
+		return n*l;
+	}
+	 Integer operator * (const long long unsigned int l, const Integer& n)
+	{
+		return n*l;
+	}
+	 Integer& operator *= (Integer& n, const long long int l)
+	{
+		return n *= (Integer)l;
+	}
+	 Integer& operator *= (Integer& n, const long long unsigned int l)
+	{
+		return n *= (Integer)l;
+	}
+#endif
+
+
+}
+#endif // __GIVARO_gmpxx_gmpxx_int_mul_C
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/gmp++/gmp++_int_pow.C b/src/kernel/gmp++/gmp++_int_pow.C
index 8625567..9520da0 100644
--- a/src/kernel/gmp++/gmp++_int_pow.C
+++ b/src/kernel/gmp++/gmp++_int_pow.C
@@ -9,85 +9,99 @@
 // $Id: gmp++_int_pow.C,v 1.4 2009-09-17 14:28:22 jgdumas Exp $
 // ==========================================================================
 // Description:
+/** @file gmp++/gmp++_int_pow.C
+ * powing stuff.
+ */
 
+#ifndef __GIVARO_gmpxx_gmpxx_int_pow_C
+#define __GIVARO_gmpxx_gmpxx_int_pow_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
+#include <cstdlib>
 
 namespace Givaro {
 
-int isperfectpower(const Integer& n)
-{
-	return mpz_perfect_power_p((mpz_srcptr)&(n.gmp_rep));
-}
+	int isperfectpower(const Integer& n)
+	{
+		return mpz_perfect_power_p((mpz_srcptr)&(n.gmp_rep));
+	}
 
-Integer& pow(Integer& Res, const unsigned long n, const unsigned long p)
-{
-  mpz_ui_pow_ui( (mpz_ptr)&(Res.gmp_rep), n, p);
-  return Res;
-}
-Integer& pow(Integer& Res, const Integer& n, const unsigned long p)
-{
-__gmpz_pow_ui( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, p);
-  return Res;
-}
+	Integer& pow(Integer& Res, const long unsigned int n, const long unsigned p)
+	{
+		mpz_ui_pow_ui( (mpz_ptr)&(Res.gmp_rep), n, p);
+		return Res;
+	}
+	Integer& pow(Integer& Res, const Integer& n, const long unsigned p)
+	{
+		__gmpz_pow_ui( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, p);
+		return Res;
+	}
 
-Integer pow(const Integer& n, const unsigned long p)
-{
-  if (p == 0) return Integer::one;
+	Integer pow(const Integer& n, const long unsigned p)
+	{
+		if (p == 0) return Integer::one;
 
-  Integer Res;
-  return pow(Res,n,p);
-}
+		Integer Res;
+		return pow(Res,n,p);
+	}
 
-Integer& pow(Integer& Res, const Integer& n, const long l)
-{
-        // Beware of negative values
-	return pow(Res, n, (unsigned long) GMP__ABS(l) );
-}
-Integer pow(const Integer& n, const long l)
-{
-  if (l < 0)  return Integer::zero;
-  return pow(n, (unsigned long) GMP__ABS(l) );
-}
+	Integer& pow(Integer& Res, const Integer& n, const long int l)
+	{
+		// Beware of negative values
+		return pow(Res, n, (long unsigned) std::abs(l) );
+	}
+	Integer pow(const Integer& n, const long int l)
+	{
+		if (l < 0)
+			return Integer::zero;
+		return pow(n, (long unsigned) std::abs(l) );
+	}
 
-Integer& powmod(Integer& Res, const Integer& n, const unsigned long p, const Integer& m)
-{
-  mpz_powm_ui( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, p, (mpz_srcptr)&m.gmp_rep);
-  return Res;
-}
+	Integer& powmod(Integer& Res, const Integer& n, const long unsigned p, const Integer& m)
+	{
+		mpz_powm_ui( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, p, (mpz_srcptr)&m.gmp_rep);
+		return Res;
+	}
 
-Integer powmod(const Integer& n, const unsigned long p, const Integer& m)
-{
-  if (p == 0) return Integer::one;
-  Integer Res;
-  return powmod(Res,n,p,m);
-}
+	Integer powmod(const Integer& n, const long unsigned p, const Integer& m)
+	{
+		if (p == 0) return Integer::one;
+		Integer Res;
+		return powmod(Res,n,p,m);
+	}
 
-Integer& powmod(Integer& Res, const Integer& n, const long e, const Integer& m)
-{
-    if (e < 0) {
-        inv(Res, n, m);
-        return powmod(Res, Res, (unsigned long)GMP__ABS(e), m);
-    } else
-        return powmod (Res, n, (unsigned long)(e), m);
-}
-Integer powmod(const Integer& n, const long e, const Integer& m)
-{
-    Integer Res;
-    return powmod(Res, n, e, m);
-}
+	Integer& powmod(Integer& Res, const Integer& n, const long e, const Integer& m)
+	{
+		if (e < 0) {
+			inv(Res, n, m);
+			return powmod(Res, Res, (long unsigned)std::abs(e), m);
+		}
+		else {
+			return powmod (Res, n, (long unsigned)(e), m);
+		}
+	}
+	Integer powmod(const Integer& n, const long e, const Integer& m)
+	{
+		Integer Res;
+		return powmod(Res, n, e, m);
+	}
 
 
-Integer& powmod(Integer& Res, const Integer& n, const Integer& e, const Integer& m)
-{
-  mpz_powm( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, (mpz_srcptr)&e.gmp_rep, (mpz_srcptr)&m.gmp_rep);
-  return Res;
-}
-Integer powmod(const Integer& n, const Integer& e, const Integer& m)
-{
-  if (e == 0) return Integer::one;
-  if (e < 0)  return Integer::zero;
-  Integer Res;
-  return powmod(Res, n, e, m);
-}
+	Integer& powmod(Integer& Res, const Integer& n, const Integer& e, const Integer& m)
+	{
+		mpz_powm( (mpz_ptr)&(Res.gmp_rep), (mpz_srcptr)&n.gmp_rep, (mpz_srcptr)&e.gmp_rep, (mpz_srcptr)&m.gmp_rep);
+		return Res;
+	}
+	Integer powmod(const Integer& n, const Integer& e, const Integer& m)
+	{
+		if (e == 0) return Integer::one;
+		if (e < 0)  return Integer::zero;
+		Integer Res;
+		return powmod(Res, n, e, m);
+	}
 
 }
+#endif // __GIVARO_gmpxx_gmpxx_int_pow_C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_rand.inl b/src/kernel/gmp++/gmp++_int_rand.inl
new file mode 100644
index 0000000..f2fc29c
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_int_rand.inl
@@ -0,0 +1,381 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_add.C,v $
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B. Boyer
+// $Id: gmp++_int_random.C,v 1.5 2011-09-16 12:09:37 bboyer Exp $
+// ==========================================================================
+
+// #include "gmp++/gmp++.h"
+/** @file gmp++/gmp++_int_rand.inl
+ * randing stuff.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_rand_INL
+#define __GIVARO_gmpxx_gmpxx_int_rand_INL
+
+#include <givaro/givtimer.h>
+#include <assert.h>
+
+namespace Givaro {
+	//-----------------------------------------------------
+	//----------------------- Random integers -------------
+	//-----------------------------------------------------
+
+	/* ********************** */
+	/* seeding, initialising  */
+	/* ********************** */
+#ifdef __GMP_PLUSPLUS__
+	gmp_randclass& Integer::randstate()
+	{
+		static gmp_randclass randstate(gmp_randinit_default);
+		return static_cast<gmp_randclass&>(randstate);
+	}
+#else
+#error "not implemented"
+#error "please include gmp++/gmp++.h very high in your inlcude list"
+#endif
+
+	inline void Integer::seeding(long unsigned int s)
+	{
+		Integer::randstate().seed(s) ;
+	}
+
+	void Integer::seeding(Integer  s)
+	{
+		Integer::randstate().seed((mpz_class) (mpz_srcptr) &(s.gmp_rep) ) ;
+	}
+
+	void Integer::seeding()
+	{
+		Integer::seeding( (long unsigned) BaseTimer::seed() );
+	}
+
+
+	// BB : good seeding but not so efficient...
+	bool Integer::RandBool()
+	{
+		if (Integer::random(1UL)) return true;
+		else return false ;
+	}
+
+
+	/* ****************************** */
+	/*  random number smaller than m  */
+	/* ****************************** */
+
+#ifdef __GMP_PLUSPLUS__
+	//! returns a random integer \p r in the intervall <code>[[0, m-1]]</code>
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_lessthan (Integer& r, const Integer & m)
+	{
+		mpz_set( (mpz_ptr) &(r.gmp_rep) ,
+			 ( (mpz_class)Integer::randstate().get_z_range((mpz_class) (mpz_srcptr) &(m.gmp_rep)) ).get_mpz_t() );
+		if(!ALWAYSPOSITIVE) if (Integer::RandBool()) Integer::negin(r);
+		return r;
+	}
+#else
+	//! returns a random integer \p r in the intervall <code>[[0, m-1]]</code>
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_lessthan (Integer& r, const Integer & m)
+	{
+		mpz_urandomm((mpz_ptr) &(r.gmp_rep),Integer::randstate(),(mpz_srcptr)&(m.gmp_rep));
+		if(!ALWAYSPOSITIVE) if (Integer::RandBool()) Integer::negin(r);
+		return r;
+	}
+#endif
+	Integer& Integer::random_lessthan (Integer& r, const Integer & m)
+	{
+		return random_lessthan<true>(r,m);
+	}
+	Integer& Integer::random_lessthan_2exp (Integer& r, const long unsigned int & m)
+	{
+		return random_lessthan_2exp<true>(r,m);
+	}
+	Integer Integer::random_lessthan_2exp (const long unsigned int & m)
+	{
+		return random_lessthan_2exp<true>(m);
+	}
+	Integer& Integer::random_lessthan (Integer& r, const long unsigned int & m)
+	{
+		return random_lessthan<true>(r,m);
+	}
+
+	template<class T>
+	Integer Integer::random_lessthan (const T & m)
+	{
+		return random_lessthan<true>(m);
+	}
+
+	/* ******************************** */
+	/*  random number smaller than 2^m  */
+	/* ******************************** */
+
+#ifdef __GMP_PLUSPLUS__
+	//! returns a random integer \p r of at most \p m bits
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_lessthan_2exp (Integer& r, const long unsigned int & m)
+	{
+		mpz_set( (mpz_ptr) &(r.gmp_rep) , ((mpz_class)Integer::randstate().get_z_bits(m)).get_mpz_t() );
+		if(!ALWAYSPOSITIVE) {
+			if (Integer::RandBool()) Integer::negin(r);
+		}
+		return r;
+	}
+#else
+	//! returns a random integer \p r of at most \p m bits
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_lessthan_2exp (Integer& r, const long unsigned int & m)
+	{
+		mpz_urandomb((mpz_ptr) &(r.gmp_rep),Integer::randstate(),m) ;
+		if(!ALWAYSPOSITIVE) if (Integer::RandBool()) Integer::negin(r);
+		return r;
+	}
+#endif
+
+	template<bool ALWAYSPOSITIVE>
+	Integer Integer::random_lessthan_2exp (const long unsigned int & m)
+	{
+		Integer r ;
+		random_lessthan_2exp<ALWAYSPOSITIVE>(r,m);
+		return r;
+	}
+
+	/* synonyms */
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_lessthan (Integer& r, const long unsigned int & m)
+	{
+		return Integer::random_lessthan_2exp<ALWAYSPOSITIVE>(r,m);
+	}
+
+	template<bool ALWAYSPOSITIVE,class T>
+	Integer Integer::random_lessthan (const T & m)
+	{
+		Integer res ;
+		return Integer::random_lessthan<ALWAYSPOSITIVE>(res,m);
+	}
+
+	/* ********************************* */
+	/*  random number of same size as s  */
+	/* ********************************* */
+
+	//! returns a reference to a random number \p r of the size of \p s, exactly.
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_exact (Integer& r, const Integer & s)
+	{
+		size_t t = s.bitsize() ;
+		Integer::random_exact_2exp<ALWAYSPOSITIVE>(r,t);
+		return r;
+	}
+	Integer& Integer::random_exact (Integer& r, const long unsigned int & m)
+	{
+		return Integer::random_exact<true>(r,m);
+	}
+	Integer& Integer::random_exact (Integer& r, const Integer & s)
+	{
+		return Integer::random_exact<true>(r,s);
+	}
+	template<bool ALWAYSPOSITIVE,class T>
+	Integer& Integer::random_exact (Integer& r, const T & m)
+	{
+		return Integer::random_exact<ALWAYSPOSITIVE>(r,static_cast<long unsigned int>(m));
+	}
+	template<class T>
+	Integer& Integer::random_exact (Integer& r, const T & m)
+	{
+		return Integer::random_exact(r,static_cast<long unsigned int>(m));
+	}
+
+	template<class T>
+	Integer Integer::random_exact (const T & s)
+	{
+		return Integer::random_exact<true>(s) ;
+	}
+
+
+
+	/* ************************* */
+	/*  random number of size m  */
+	/* ************************* */
+
+	//! returns a reference to a random number \p r of the size \p m bits, exactly.
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_exact_2exp (Integer& r, const long unsigned int & m)
+	{
+		if (m) random_lessthan_2exp<true>(r,m-1);
+		mpz_setbit( (mpz_ptr) &(r.gmp_rep) , m-1);
+		if(!ALWAYSPOSITIVE) if (Integer::RandBool()) Integer::negin(r);
+		return r;
+	}
+
+	Integer& Integer::random_exact_2exp (Integer& r, const long unsigned int & m)
+	{
+		return Integer::random_exact<true>(r,m);
+	}
+	// synonym
+	template<bool ALWAYSPOSITIVE>
+	Integer& Integer::random_exact (Integer& r, const long unsigned int & m)
+	{
+		return Integer::random_exact_2exp<ALWAYSPOSITIVE>(r,m) ;
+	}
+
+	template<bool ALWAYSPOSITIVE,class T>
+	Integer Integer::random_exact (const T & s)
+	{
+		Integer res ;
+		return random_exact<ALWAYSPOSITIVE>(res,s);
+	}
+
+	/* **************************** */
+	/*  random number in [[m,M-1]]  */
+	/* **************************** */
+
+	Integer& Integer::random_between (Integer& r, const Integer& m, const Integer&M)
+	{
+		assert(M > m);
+		random_lessthan(r,Integer(M-m));
+		r += m ;
+		return (r);
+	}
+
+	Integer Integer::random_between (const Integer& m, const Integer &M)
+	{
+		Integer r ;
+		return random_between(r,m,M);
+	}
+
+
+	template<class R>
+	Integer Integer::random_between (const R & m, const R & M)
+	{
+		return Integer::random_between(static_cast<long unsigned int>(m),
+					       static_cast<long unsigned int>(M));
+	}
+	template<class R>
+	Integer & Integer::random_between (Integer &r, const R & m, const R & M)
+	{
+		return Integer::random_between(r,static_cast<long unsigned int>(m),
+					       static_cast<long unsigned int>(M));
+	}
+
+
+	/* ******************************** */
+	/*  random number in [[2^m,2^M-1]]  */
+	/* ******************************** */
+	// todo : template<bool ALWAYSPOSITIVE, bool V>
+	Integer& Integer::random_between_2exp (Integer& r, const long unsigned int& m, const long unsigned int &M)
+	{
+		assert(M > m);
+		r = nonzerorandom((long unsigned int)M-m);
+		Integer r1 = random_lessthan_2exp(m);
+		r <<= m ;
+		r+= r1 ;
+		return (r);
+	}
+
+	Integer Integer::random_between_2exp (const long unsigned int & m, const long unsigned int &M)
+	{
+		Integer r ;
+		return random_between_2exp(r,m,M);
+	}
+
+	// synonym.
+	Integer Integer::random_between (const long unsigned int & m, const long unsigned int &M)
+	{
+		return random_between_2exp(m,M) ;
+	}
+
+
+	Integer& Integer::random_between (Integer& r, const long unsigned int& m, const long unsigned int &M)
+	{
+		return random_between_2exp(r,m,M);
+	}
+	/* **************/
+	/*  short hand  */
+	/* **************/
+
+	//! returns a random integer less than...
+	template<bool ALWAYSPOSITIVE,class T>
+	Integer& Integer::random (Integer& r, const T & m)
+	{
+		return Integer::random_lessthan<ALWAYSPOSITIVE>(r,m) ;
+	}
+
+	//! returns a random integer less than...
+	template<bool ALWAYSPOSITIVE,class T>
+	Integer Integer::random(const T & sz)
+	{
+		return Integer::random_lessthan<ALWAYSPOSITIVE,T>(sz);
+	}
+
+	Integer Integer::random()
+	{
+		return Integer::random(sizeof(mp_limb_t)*8) ;
+	}
+	template<bool ALWAYSPOSITIVE>
+	Integer Integer::random()
+	{
+		Integer rez = Integer::random(sizeof(mp_limb_t)*8) ;
+		if (!ALWAYSPOSITIVE) if (Integer::RandBool()) negin(rez);
+		return rez;
+	}
+
+	template<class T>
+	Integer& Integer::random (Integer& r, const T & m)
+	{
+		return Integer::random<true,T>(r,m);
+	}
+
+	template<class T>
+	Integer Integer::random(const T & sz)
+	{
+		return Integer::random<true>(sz);
+	}
+
+	/* *******************/
+	/*  Non Zero random  */
+	/* *******************/
+
+	template<bool ALWAYSPOSITIVE, class T>
+	Integer Integer::nonzerorandom(const T & sz)
+	{
+		Integer r;
+		while(isZero(Integer::random<ALWAYSPOSITIVE,T>(r, sz) )) {} ;
+		return r;
+	}
+
+	// BB: It's also 1+random(sz-1)...
+
+	template<bool ALWAYSPOSITIVE, class T>
+	Integer& Integer::nonzerorandom (Integer& r, const T& size)
+	{
+		while (isZero(Integer::random<ALWAYSPOSITIVE,T>(r,size))) {} ;
+		return r;
+	}
+
+	template<class T>
+	Integer  Integer::nonzerorandom(const T & sz)
+	{
+		return  Integer::nonzerorandom<true>(sz);
+	}
+	template<class T>
+	Integer&  Integer::nonzerorandom (Integer& r, const T& size)
+	{
+		return  Integer::nonzerorandom<true>(r,size);
+	}
+	Integer  Integer::nonzerorandom()
+	{
+		Integer rez = Integer::nonzerorandom(sizeof(mp_limb_t)*8) ;
+		// if (!ALWAYSPOSITIVE) if (Integer::RandBool()) negin(rez);
+		return rez;
+	}
+
+
+}
+
+#endif // __GIVARO_gmpxx_gmpxx_int_rand_INL
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_int_sub.C b/src/kernel/gmp++/gmp++_int_sub.C
index 6c67485..24c34fb 100644
--- a/src/kernel/gmp++/gmp++_int_sub.C
+++ b/src/kernel/gmp++/gmp++_int_sub.C
@@ -9,132 +9,207 @@
 // $Id: gmp++_int_sub.C,v 1.4 2009-09-17 14:28:22 jgdumas Exp $
 // ==========================================================================
 
+/** @file gmp++/gmp++_int_sub.C
+ * subing stuff.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_int_sub_C
+#define __GIVARO_gmpxx_gmpxx_int_sub_C
+
+#ifndef __GIVARO_INLINE_ALL
 #include "gmp++/gmp++.h"
+#endif
 
 namespace Givaro {
 
-//-------------------------------------------------- operator -
-Integer& Integer::subin(Integer& res, const Integer& n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = - n;
-  mpz_sub( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
-  return res;
-}
-Integer& Integer::subin(Integer& res, const long n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = - n;
-  int sgn = GMP__SGN(n);
-  if (sgn >0) mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
-  else mpz_add_ui((mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, -n);
-  return res;
-}
-Integer& Integer::subin(Integer& res, const unsigned long n)
-{
-  if (isZero(n)) return res;
-  if (isZero(res)) return res = - n;
-  mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
-  return res;
-}
+	//-------------------------------------------------- operator -
+	Integer& Integer::subin(Integer& res, const Integer& n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = - n;
+		mpz_sub( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep );
+		return res;
+	}
+	Integer& Integer::subin(Integer& res, const long int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = - n;
+		int sgn = Givaro::sign(n);
+		if (sgn >0) mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
+		else mpz_add_ui((mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, -n);
+		return res;
+	}
+	Integer& Integer::subin(Integer& res, const long unsigned int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = - n;
+		mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
+		return res;
+	}
 
-Integer& Integer::sub(Integer& res, const Integer& n1, const Integer& n2)
-{
-  if (isZero(n1)) return res = - n2;
-  if (isZero(n2)) return res = n1;
-  mpz_sub( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
-  return res;
-}
-Integer& Integer::sub(Integer& res, const Integer& n1, const long n2)
-{
-  if (isZero(n1)) return res = - n2;
-  if (isZero(n2)) return res = n1;
-  int sgn = GMP__SGN(n2);
-  if (sgn >0) mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
-  else mpz_add_ui((mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, -n2);
-  return res;
-}
-Integer& Integer::sub(Integer& res, const Integer& n1, const unsigned long n2)
-{
-  if (isZero(n1)) return res = - n2;
-  if (isZero(n2)) return res = n1;
-  mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
-  return res;
-}
+	Integer& Integer::sub(Integer& res, const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return res = - n2;
+		if (isZero(n2)) return res = n1;
+		mpz_sub( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
+		return res;
+	}
+	Integer& Integer::sub(Integer& res, const Integer& n1, const long int n2)
+	{
+		if (isZero(n1)) return res = - n2;
+		if (isZero(n2)) return res = n1;
+		int sgn = Givaro::sign(n2);
+		if (sgn >0) mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		else mpz_add_ui((mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, -n2);
+		return res;
+	}
+	Integer& Integer::sub(Integer& res, const Integer& n1, const long unsigned int n2)
+	{
+		if (isZero(n1)) return res = - n2;
+		if (isZero(n2)) return res = n1;
+		mpz_sub_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		return res;
+	}
 
-Integer& Integer::neg(Integer& res, const Integer& n)
-{
-  mpz_neg( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep);
-  return res;
-}
+	Integer& Integer::neg(Integer& res, const Integer& n)
+	{
+		mpz_neg( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n.gmp_rep);
+		return res;
+	}
 
-Integer& Integer::negin(Integer& res)
-{
-  mpz_neg( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep);
-  return res;
-}
+	Integer& Integer::negin(Integer& res)
+	{
+		mpz_neg( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep);
+		return res;
+	}
 
 
-Integer& Integer::operator -= (const Integer& n)
-{
-  if (isZero(n)) return *this;
-  if (isZero(*this)) return logcpy(-n);
-//   Rep (res.gmp_rep)( MAX(SZ_REP(n.gmp_rep),SZ_REP(gmp_rep)) );
-  mpz_sub( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
-  return *this;
-}
+	Integer& Integer::operator -= (const Integer& n)
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return logcpy(-n);
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(n.gmp_rep),SZ_REP(gmp_rep)) );
+		mpz_sub( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return *this;
+	}
 
-Integer& Integer::operator -= (const unsigned long l)
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return logcpy(Integer(-l));
-//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
-  mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
-  return *this;
-}
+	Integer& Integer::operator -= (const long unsigned int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(-l));
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
+		mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		return *this;
+	}
 
-Integer& Integer::operator -= (const long l)
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return logcpy(Integer(-l));
-//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
-  int sgn = GMP__SGN(l);
-  if (sgn >0) mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
-  else mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, -l);
-  return *this;
-}
+	Integer& Integer::operator -= (const long int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(-l));
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
+		int sgn = Givaro::sign(l);
+		if (sgn >0) mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		else mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, -l);
+		return *this;
+	}
 
 
-Integer Integer::operator - (const Integer& n) const
-{
-  if (isZero(n)) return *this;
-  if (isZero(*this)) return -n;
-//   Rep (res.gmp_rep)( MAX(SZ_REP(n.gmp_rep),SZ_REP(gmp_rep)) );
-  Integer res;
-  mpz_sub( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
-  return res;
-}
+	Integer Integer::operator - (const Integer& n) const
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return -n;
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(n.gmp_rep),SZ_REP(gmp_rep)) );
+		Integer res;
+		mpz_sub( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return res;
+	}
 
-Integer Integer::operator - (const unsigned long l) const
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return Integer(-l);
-//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
-  Integer res;
-  mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
-  return res;
-}
+	Integer Integer::operator - (const long unsigned int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(-l);
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
+		Integer res;
+		mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		return res;
+	}
 
-Integer Integer::operator - (const long l) const
-{
-  if (l==0) return *this;
-  if (isZero(*this)) return Integer(-l);
-//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
-  Integer res;
-  int sgn = GMP__SGN(l);
-  if (sgn >0) mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
-  else mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, -l);
-  return res;
-}
+	Integer Integer::operator - (const long int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(-l);
+		//   Rep (res.gmp_rep)( MAX(SZ_REP(gmp_rep),1) );
+		Integer res;
+		int sgn = Givaro::sign(l);
+		if (sgn >0) mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		else mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, -l);
+		return res;
+	}
+
+	// -- operator -
+	Integer operator - (const int l, const Integer& n)
+	{
+		return -(n - (long)l);
+	}
+	Integer operator - (const unsigned int l, const Integer& n)
+	{
+		return -(n - (long unsigned)l);
+	}
+	Integer operator - (const long int l, const Integer& n)
+	{
+		return -(n - l);
+	}
+	Integer operator - (const long unsigned int l, const Integer& n)
+	{
+		return -(n - l);
+	}
+	Integer operator - (const Integer& n, const int l)
+	{
+		return n - (long)l;
+	}
+	Integer operator - (const Integer& n, const unsigned int l)
+	{
+		return n - (long unsigned)l;
+	}
+
+	Integer& operator -= (Integer& n, const int l)
+	{
+		return n -= (long)l;
+	}
+	Integer& operator -= (Integer& n, const unsigned int l)
+	{
+		return n -= (long unsigned)l;
+	}
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	Integer operator - (const Integer& n, const long long int l)
+	{
+		return n - (Integer)l;
+	}
+	Integer operator - (const Integer& n, const long long unsigned int l)
+	{
+		return n - (Integer)l;
+	}
+	Integer operator - (const long long int l, const Integer& n)
+	{
+		return n-l;
+	}
+	Integer operator - (const long long unsigned int l, const Integer& n)
+	{
+		return n-l;
+	}
+	Integer& operator -= (Integer& n, const long long int l)
+	{
+		return n -= (Integer)l;
+	}
+	Integer& operator -= (Integer& n, const long long unsigned int l)
+	{
+		return n -= (Integer)l;
+	}
+#endif
 
 }
+
+#endif // __GIVARO_gmpxx_gmpxx_int_sub_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat.C b/src/kernel/gmp++/gmp++_rat.C
new file mode 100644
index 0000000..7894a84
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat.C
@@ -0,0 +1,23 @@
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+#ifndef __GMPplusplus_RATIONAL_C__
+#define __GMPplusplus_RATIONAL_C__
+
+// #include "gmp++/gmp++.h"
+
+#include "gmp++_rat_cstor.C"
+#include "gmp++_rat_add.C"
+// #include "gmp++_rat_sub.C"
+// #include "gmp++_rat_mul.C"
+// #include "gmp++_rat_pow.C"
+// #include "gmp++_rat_div.C"
+// #include "gmp++_rat_mod.C"
+// #include "gmp++_rat_gcd.C"
+#include "gmp++_rat_misc.C"
+#include "gmp++_rat_compare.C"
+#include "gmp++_rat_io.C"
+
+#endif
diff --git a/src/kernel/gmp++/gmp++_rat.h b/src/kernel/gmp++/gmp++_rat.h
new file mode 100644
index 0000000..5f5e4c9
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat.h
@@ -0,0 +1,291 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_Rationel.h,v $
+// Copyright(c)'1994-2011 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B. Boyer <bboyer at imag.fr>
+// $Id: givRationel.h,v 0.0 2011-09-15 18:23:56 bboyer Exp $
+// ==========================================================================
+
+#ifndef __GIVARO_GMPplusplus_Rationel_H
+#define __GIVARO_GMPplusplus_Rationel_H
+// #define __GIVARO_Rationel_H
+
+/*! @file gmp++/gmp++_rat.h
+ * @ingroup Rationel
+ * Core Rationel from GMP
+ */
+
+#include <gmp++/gmp++_int.h>
+
+namespace Givaro
+{
+	class Rationel ;
+	Rationel 	abs(const Rationel& n);
+	std::istream& 	operator >> (std::istream &i, Rationel& n);
+	std::ostream& 	operator << (std::ostream &o, const Rationel& n);
+	std::ostream& 	absOutput (std::ostream &o, const Rationel& n);
+	void 		importWords(Rationel&, size_t, int, int, int, size_t, const void*);
+
+
+	class Rationel
+	{
+	public:
+		enum reduceFlag  { Reduce = 0x1, NoReduce = 0x0 } ;
+		// enum ReducedFlag { Reduced = 0x2, NoReduced = 0x3 } ;
+
+	protected:
+
+		typedef __mpq_struct Rep;
+		typedef __mpz_struct RawRep ;
+
+		Rep gmp_rep;
+		RawRep * num ;
+		RawRep * den ;
+
+		int privSign() const;
+
+		const Rep* get_rep() const
+		{
+			return &gmp_rep;
+		}
+
+	public :
+
+		// CONSTRUCTORS (gmp++_rat_cstor.C)
+		//! default constructor (0/1).
+		giv_all_inlined Rationel() ;
+
+		//! constructors from a single numerator.
+		//!@param n numerator, will make fraction n/1
+		//@{
+
+		giv_all_inlined Rationel( Integer & n) ;
+
+		giv_all_inlined Rationel( int  n) ;
+		giv_all_inlined Rationel( unsigned int  n) ;
+
+		giv_all_inlined Rationel( long int  n) ;
+		giv_all_inlined Rationel( long unsigned int  n) ;
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+		giv_all_inlined Rationel( long long int  n) ;
+		giv_all_inlined Rationel( long long unsigned int  n) ;
+#endif
+		//@}
+
+		//! constructors from a  numerator and a denominator.
+		/*! @param n numerator
+		 * @param d denominator, will produce fraction \c n/d
+		 * @param reduceFlag by defaut, noting is reduced.
+		 * @pre we suppose \c d!=0. this is not asserted in \c NDEBUG mode !
+		 */
+		//@{
+		giv_all_inlined Rationel( Integer & n, Integer & d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( int n, int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( unsigned int n, int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long int n, int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long unsigned int n, int d,
+					  enum reduceFlag = NoReduce) ;
+
+		giv_all_inlined Rationel( int n, unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( int n, long int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( int n, long unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+
+		giv_all_inlined Rationel( unsigned int n, unsigned int d,
+					  enum reduceFlag = NoReduce);
+		giv_all_inlined Rationel( unsigned int n, long int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( unsigned int n, long unsigned int d,
+					  enum reduceFlag = NoReduce);
+
+		giv_all_inlined Rationel( long unsigned int n, unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long int n, unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+
+
+		giv_all_inlined Rationel( long int n, long int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long unsigned int n, long int d,
+					  enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long int n, long unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+
+		giv_all_inlined Rationel( long unsigned int n, long unsigned int d,
+					  enum reduceFlag = NoReduce) ;
+
+		template<class T>
+		giv_all_inlined Rationel( Integer & n, T d,
+					  enum reduceFlag = NoReduce) ;
+		template<class T>
+		giv_all_inlined Rationel( T n, Integer & d,
+					  enum reduceFlag = NoReduce) ;
+		template<class T, class U>
+		giv_all_inlined Rationel( T n, U d, enum reduceFlag = NoReduce) ;
+		template<class T, class U>
+		giv_all_inlined Rationel( T & n, U & d, enum reduceFlag = NoReduce) ;
+
+		//@}
+
+		//! constructors from another Rationel
+		/*! @param f the Rationel to be represented
+		 * @param reduceFlag a flag to start reduction or not.
+		 */
+		//@{
+		giv_all_inlined Rationel( Rationel & f, enum reduceFlag = NoReduce) ;
+
+		giv_all_inlined Rationel( float f, enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( double f, enum reduceFlag = NoReduce) ;
+		giv_all_inlined Rationel( long double f, enum reduceFlag = NoReduce) ;
+		//@}
+
+		// destructors
+		/*! Destructor.
+		 * Clearing the \c mpq representation.
+		 */
+		~Rationel()
+		{
+			mpq_clear((mpq_ptr)&gmp_rep);
+		}
+
+		// ADD
+
+		static giv_all_inlined Rationel& addin(Rationel& res, const Rationel& n);
+		static giv_all_inlined Rationel& addin(Rationel& res, const Integer& n) ;
+
+		// SUB
+		static giv_all_inlined Rationel& negin (Rationel& res)
+		{
+			mpq_neg((mpq_ptr)res.get_mpq(),
+				(mpq_ptr)res.get_mpq());
+			return res ;
+		}
+		giv_all_inlined  Rationel& negin ()
+		{
+			mpq_neg((mpq_ptr)&gmp_rep,(mpq_ptr)&gmp_rep);
+			return *this;
+		}
+
+
+		// Conversions/Casts (gmp++_rat_cast.C)
+		giv_all_inlined operator std::string() const ;
+
+		// (gmp++_rat_compare.C)
+		friend  giv_all_inlined Rationel abs(const Rationel& n);
+
+		// Input/output of Rationels (gmp++_rat_io.C)
+		/*! @name I/O
+		*/
+		//@{
+		friend  giv_all_inlined std::istream& operator >> (std::istream &i, Rationel & n);
+		friend giv_all_inlined std::ostream& operator << (std::ostream &o, const Rationel & n);
+		friend  giv_all_inlined std::ostream& absOutput (std::ostream &o, const Rationel& n);
+
+		// friend void importWords(Integer&, size_t, int, int, int, size_t, const void*);
+
+		giv_all_inlined	std::ostream& print( std::ostream& o ) const;
+		//@}
+
+
+		// basic acessing operations and other tools (gmp++_rat_misc.C)
+		/*! Gets the denominator of a \c Rationel.
+		 * @return the \c Integer denominator.
+		 */
+		giv_all_inlined Integer  getDenom() const ;
+		/*! Gets the numerator of a \c Rationel.
+		 * @return the \c Integer numerator .
+		 */
+		giv_all_inlined Integer  getNumer() const ;
+
+		/*! Retrieve the GMP representation of a Rationel.
+		 * @return a pointer to this representation.
+		 */
+		giv_all_inlined mpq_ptr get_mpq()     ;
+		giv_all_inlined mpq_srcptr get_mpq_const()     const ;
+		/*! Retrieve the GMP representation of the denominator of a Rationel.
+		 * @return a pointer to this denominator (integer).
+		 */
+		giv_all_inlined mpz_ptr get_mpq_den() const ;
+		/*! Retrieve the GMP representation of the numerator of a Rationel.
+		 * @return a pointer to this numerator (integer).
+		 */
+		giv_all_inlined mpz_ptr get_mpq_num() const ;
+
+		/*! Reduces (inplace) a fraction to a canonical representation.
+		 * @return a reference to self.
+		 */
+		giv_all_inlined 	Rationel& reduce();
+		/*! Reduces a fraction to a canonical representation.
+		 * @param r a \c Rationel
+		 * @return a reference to the reduced \p r.
+		 */
+		static giv_all_inlined Rationel& reduce(Rationel & r) ;//const
+
+		static inline int isZero(const Rationel &n)
+		{
+			return (mpq_sgn((mpq_srcptr)&n.gmp_rep) == 0) ;
+		}
+
+		giv_all_inlined int isZero()
+		{
+			return (mpq_sgn((mpq_srcptr)&gmp_rep) == 0);
+		}
+
+		//------------------------------------------operator = (const Integer &n)
+		giv_all_inlined Rationel& logcpy(const Rationel &n)
+		{
+			if (this == &n) return *this;
+			mpq_set ( (mpq_ptr)&gmp_rep, (mpq_srcptr)&(n.gmp_rep)) ;
+			return *this;
+		}
+
+		// same as logcopy
+		giv_all_inlined Rationel& operator = (const Rationel &n)
+		{
+			return logcpy(n) ;
+		}
+
+		giv_all_inlined Rationel& operator = (const Integer &n)
+		{
+			mpq_set_z ( (mpq_ptr)&gmp_rep, (mpz_srcptr)(n.get_mpz_const())) ;
+			return *this;
+		}
+
+		static giv_all_inlined void setInteger(Rationel &f, const Integer & n)
+		{
+			// (( (mpq_ptr)&f.gmp_rep )->_mp_num ) =  (mpz_srcptr) n.get_mpz_const() ;
+			// mpz_t a ;
+			// mpz_init(a);
+			// mpz_ptr a = mpq_numref( (mpq_ptr)&f.gmp_rep );
+			// a = const_cast<mpz_ptr>( n.get_mpz_const() );
+			mpz_set( (mpz_ptr)&(f.gmp_rep._mp_num), const_cast<mpz_ptr>( n.get_mpz_const() ) ) ;
+
+		}
+
+	protected:
+		static reduceFlag flags ;    //!< flag that indicates reduction is done or not after an operation.   By default, this is Reduce (as in GMP).
+
+
+
+	};
+}
+
+#ifdef __GIVARO_INLINE_ALL
+#include "gmp++_rat.C"
+#endif
+
+#include "gmp++_rat.inl"
+
+#endif // __GIVARO_GMPplusplus_Rationel_H
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat.inl b/src/kernel/gmp++/gmp++_rat.inl
new file mode 100644
index 0000000..4293c1f
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat.inl
@@ -0,0 +1,81 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_cstor.C,v $
+// Copyright(c)'1994-2011 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B. Boyer
+// $Id: gmp++_rat_cstor.C,v 1.4 2011-09-16 14:28:22 bboyer Exp $
+// ==========================================================================
+
+#ifndef __GIVARO_gmpxx_gmpxx_rat_INL
+#define __GIVARO_gmpxx_gmpxx_rat_INL
+
+namespace Givaro
+{
+	// Integer constructors fallbacks
+	template<class T>
+	Rationel::Rationel( Integer & n, T d, enum reduceFlag red)
+	{
+		assert(nonZero(d)); //! @todo nonZero() ?
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_srcptr)n.get_mpz_const());
+		mpq_set_den((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(d).get_mpz());
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	template<class T>
+	Rationel::Rationel( T n, Integer & d, enum reduceFlag red)
+	{
+		assert(nonZero(d)); //! @todo nonZero() ?
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(n).get_mpz());
+		mpq_set_den((mpq_ptr)&gmp_rep,(mpz_srcptr)d.get_mpz_const());
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	template<class T, class U>
+	Rationel::Rationel( T n, U d, enum reduceFlag red)
+	{
+		assert(nonZero(d)); //! @todo nonZero() ?
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(n).get_mpz());
+		mpq_set_den((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(d).get_mpz());
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	template<class T, class U>
+	Rationel::Rationel( T & n, U & d, enum reduceFlag red)
+	{
+		assert(nonZero(d)); //! @todo nonZero() ?
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(n).get_mpz());
+		mpq_set_den((mpq_ptr)&gmp_rep,(mpz_ptr)Integer(d).get_mpz());
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+}
+
+
+#endif // __GIVARO_gmpxx_gmpxx_rat_INL
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat_add.C b/src/kernel/gmp++/gmp++_rat_add.C
new file mode 100644
index 0000000..8f36a1c
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat_add.C
@@ -0,0 +1,215 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_add.C,v $
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: M. Samama, T. Gautier
+// $Id: gmp++_int_add.C,v 1.5 2010-12-20 12:09:37 bboyer Exp $
+// ==========================================================================
+
+
+#ifndef __GIVARO_gmpxx_gmpxx_rat_add_C
+#define __GIVARO_gmpxx_gmpxx_rat_add_C
+
+#ifndef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++.h"
+#endif
+
+namespace Givaro {
+	//-------------------------------------------------- operator +
+	Rationel& Rationel::addin(Rationel& res, const Rationel& n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		mpq_add( (mpq_ptr)&res.gmp_rep, (mpq_srcptr)&res.gmp_rep, (mpq_srcptr)&n.gmp_rep );
+		return res;
+	}
+
+	Rationel& Rationel::addin(Rationel& res, const Integer& n)
+	{
+		if (Givaro::isZero(n)) return res;
+		Rationel nn ;
+		setInteger(nn,n);
+		if (isZero(res)) return res = nn;
+		mpq_add( (mpq_ptr)&res.gmp_rep, (mpq_srcptr)&res.gmp_rep, (mpq_srcptr)&nn.gmp_rep );
+		return res;
+	}
+
+#if 0
+	Rationel& Rationel::addin(Rationel& res, const long int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		int sgn = sign(n);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, n);
+		else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_ptr)&res.gmp_rep, -n);
+		return res;
+	}
+	Rationel& Rationel::addin(Rationel& res, const long unsigned int n)
+	{
+		if (isZero(n)) return res;
+		if (isZero(res)) return res = n;
+		mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&res.gmp_rep, n);
+		return res;
+	}
+
+	Rationel& Rationel::add(Rationel& res, const Integer& n1, const Integer& n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		mpz_add( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, (mpz_srcptr)&n2.gmp_rep);
+		return res;
+	}
+	Rationel& Rationel::add(Rationel& res, const Integer& n1, const long int n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		int sgn = sign(n2);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		else mpz_sub_ui((mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, -n2);
+		return res;
+	}
+	Rationel& Rationel::add(Rationel& res, const Integer& n1, const long unsigned int n2)
+	{
+		if (isZero(n1)) return res = n2;
+		if (isZero(n2)) return res = n1;
+		mpz_add_ui( (mpz_ptr)&res.gmp_rep, (mpz_srcptr)&n1.gmp_rep, n2);
+		return res;
+	}
+
+	// -- operator +
+
+	Integer& Integer::operator += (const Integer& n)
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return logcpy(n);
+		mpz_add( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return *this;
+	}
+
+	Integer& Integer::operator += (const long unsigned int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(l));
+		mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		return *this;
+	}
+
+	Integer& Integer::operator += (const long int l)
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return logcpy(Integer(l));
+		int sgn = sign(l);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, l);
+		else mpz_sub_ui( (mpz_ptr)&(gmp_rep), (mpz_ptr)&gmp_rep, -l);
+		return *this;
+	}
+
+
+	Integer Integer::operator + (const Integer& n) const
+	{
+		if (isZero(n)) return *this;
+		if (isZero(*this)) return n;
+		Integer res;
+		mpz_add( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, (mpz_srcptr)&n.gmp_rep) ;
+		return res;
+	}
+
+	Integer Integer::operator + (const long unsigned int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(l);
+		Integer res;
+		mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		return res;
+	}
+
+	Integer Integer::operator + (const long int l) const
+	{
+		if (l==0) return *this;
+		if (isZero(*this)) return Integer(l);
+		Integer res;
+		int sgn = sign(l);
+		if (sgn >0) mpz_add_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, l);
+		else mpz_sub_ui( (mpz_ptr)&(res.gmp_rep), (mpz_srcptr)&gmp_rep, -l);
+		return res;
+	}
+
+	Integer Integer::operator - () const
+	{
+		// JGD 18.06.1999
+		Integer Res ;
+		mpz_neg((mpz_ptr)&Res.gmp_rep, (mpz_srcptr)&gmp_rep );
+		return Res ;
+	}
+
+	Integer operator + (const int l, const Integer& n)
+	{
+		return n + (long)l;
+	}
+	Integer operator + (const unsigned int l, const Integer& n)
+	{
+		return n + (long unsigned)l;
+	}
+	Integer operator + (const long int l, const Integer& n)
+	{
+		return n + l;
+	}
+	Integer operator + (const long unsigned int l, const Integer& n)
+	{
+		return n + l;
+	}
+	Integer operator + (const Integer& n, const int l)
+	{
+		return n + (long)l;
+	}
+	Integer operator + (const Integer& n, const unsigned int l)
+	{
+		return n + (long unsigned)l;
+	}
+
+	Integer& operator += (Integer& n, const int l)
+	{
+		return n += (long)l;
+	}
+	Integer& operator += (Integer& n, const unsigned int l)
+	{
+		return n += (long unsigned)l;
+	}
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	Integer operator + (const Integer& n, const long long int l)
+	{
+		return n + (Integer)l;
+	}
+	Integer operator + (const Integer& n, const long long unsigned int l)
+	{
+		return n + (Integer)l;
+	}
+	Integer operator + (const long long int l, const Integer& n)
+	{
+		return n+l;
+	}
+	Integer operator + (const long long unsigned int l, const Integer& n)
+	{
+		return n+l;
+	}
+	Integer& operator += (Integer& n, const long long int l)
+	{
+		return n += (Integer)l;
+	}
+	Integer& operator += (Integer& n, const long long unsigned int l)
+	{
+		return n += (Integer)l;
+	}
+#endif
+#endif
+
+
+}
+
+#endif // __GIVARO_gmpxx_gmpxx_int_add_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat_compare.C b/src/kernel/gmp++/gmp++_rat_compare.C
new file mode 100644
index 0000000..9b2edb4
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat_compare.C
@@ -0,0 +1,107 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_compare.C,v $
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: M. Samama, T. Gautier
+// $Id: gmp++_int_compare.C,v 1.6 2009-09-17 14:28:22 jgdumas Exp $
+// ==========================================================================
+
+/*! @file gmp++/gmp++_rat_compare.C
+ * @brief routines to compare integers.
+ */
+
+#ifndef __GIVARO_gmpxx_gmpxx_rat_compare_C
+#define __GIVARO_gmpxx_gmpxx_rat_compare_C
+
+#ifndef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++.h"
+#endif
+
+#if 0
+namespace Givaro {
+
+	/*! Compares two integers.
+	 * @param a integer
+	 * @param b integer
+	 * @return \c 1 if \f$a > b\f$, \c 0 if \f$a = b\f$ and \p -1 otherwise.
+	 */
+	int compare(const Integer &a, const Integer& b)
+	{
+		return mpz_cmp ( (mpz_srcptr)&a.gmp_rep, (mpz_srcptr)&b.gmp_rep );
+	}
+
+	/*! Compare the norm of two integers.
+	 * @param a integer
+	 * @param b integer
+	 * @return \c 1 if \f$|a| > |b|\f$, \c 0 if \f$|a| = |b|\f$ and \p -1 otherwise.
+	 */
+	int absCompare(const Integer &a, const Integer &b)
+	{
+		return mpz_cmpabs( (mpz_srcptr)&(a.gmp_rep), (mpz_srcptr)&(b.gmp_rep));
+	}
+
+	int Integer::operator != (const int l) const
+	{
+		return mpz_cmp_si ( (mpz_srcptr)&gmp_rep, l ) != 0;
+	}
+
+	int Integer::operator != (const long int l) const
+	{
+		return mpz_cmp_si ( (mpz_srcptr)&gmp_rep, l ) != 0;
+	}
+
+	//long unsigned ops added by Dan Roche, 6-26-04
+	int Integer::operator != (const long unsigned int l) const
+	{
+		return mpz_cmp_ui ( (mpz_srcptr)&gmp_rep, l ) != 0;
+	}
+
+	int Integer::operator > (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) > 0;
+	}
+
+	int Integer::operator < (const long unsigned int l) const
+	{
+		return mpz_cmp_ui((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+	int Integer::operator > (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0;
+	}
+
+	int Integer::operator > (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) > 0;
+	}
+
+	int Integer::operator < (const int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+	int Integer::operator < (const long int l) const
+	{
+		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0;
+	}
+
+}
+#endif
+
+namespace Givaro {
+
+		Rationel abs(const Rationel& f)
+		{
+			Rationel absf ;
+			mpq_abs((mpq_ptr)absf.get_mpq(),(mpq_srcptr)f.get_mpq_const());
+			return absf ;
+		}
+}
+
+#endif // __GIVARO_gmpxx_gmpxx_rat_compare_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/gmp++/gmp++_rat_cstor.C b/src/kernel/gmp++/gmp++_rat_cstor.C
new file mode 100644
index 0000000..2cbad4f
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat_cstor.C
@@ -0,0 +1,429 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_cstor.C,v $
+// Copyright(c)'1994-2011 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B. Boyer
+// $Id: gmp++_rat_cstor.C,v 1.4 2011-09-16 14:28:22 bboyer Exp $
+// ==========================================================================
+#ifndef __GMPplusplus_rat_cstor_C__
+#define __GMPplusplus_rat_cstor_C__
+#include <iostream>
+#ifndef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++.h"
+#endif
+
+namespace Givaro
+{
+	// CONSTRUCTORS FROM INTEGERS
+	Rationel::Rationel()
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+	}
+
+	Rationel::Rationel( Integer & n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_srcptr)n.get_mpz_const());
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep,(long int) n, 1L) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( unsigned int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep,(long unsigned int) n, 1UL) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( long int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep, n, 1L) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( long unsigned int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep, n, 1UL) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+#ifdef __USE_GMPPLUSPLUS_SIXTYFOUR__
+	Rationel::Rationel( long long int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,((Integer)n).get_mpz_const()) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( long long unsigned int  n)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,((Integer)n).get_mpz()) ;
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+#endif
+
+
+	// CONSTRUCTORS FROM RationelS
+	Rationel::Rationel( float f, enum reduceFlag red)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_d((mpq_ptr)&gmp_rep,(double)f);
+		std::cout<< "max precision OR best approximation ?" << std::endl;
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel( double f, enum reduceFlag red)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+
+		mpq_set_d((mpq_ptr)&gmp_rep,f);
+		// XXX
+		std::cout<< "max precision OR best approximation ?" << std::endl;
+		if (red)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	Rationel::Rationel(long double f, enum reduceFlag red)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+
+		// XXX
+		throw "Rationel constructor from long double is not implemented yet";
+		if (red)
+			reduce();
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+	}
+
+	//!@todo Initialise Rationels from mpq_f and mpfr types.
+
+	Rationel::Rationel( Rationel & n, enum reduceFlag red)
+	{
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set( (mpq_ptr)&gmp_rep, (mpq_srcptr)n.get_mpq() );
+		if (red == Reduce)
+			reduce();
+	}
+
+	// CONSTRUCTORS FROM NUM AND DEN
+	Rationel::Rationel( Integer & n, Integer & d, enum reduceFlag red)
+	{
+		assert(nonZero(d)); //! @todo nonZero() ?
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_z((mpq_ptr)&gmp_rep,(mpz_srcptr)n.get_mpz_const());
+		mpq_set_den((mpq_ptr)&gmp_rep,(mpz_srcptr)d.get_mpz_const());
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	/*
+	 *
+	 *  d\n  | I   U   L  UL
+	 *  -----------------------
+	 *  I    | si  si  si ui
+	 *  U    | si  ui  si ui
+	 *  L    | si  si  ?? ??
+	 *  UL   | si  ui  ?? ui
+	 */
+
+	// castable to long int/long int
+	// INT
+	Rationel::Rationel( int n, int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0)
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)-n, (long unsigned int)-d);
+		else
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( unsigned int n, int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0)
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)-n, (long unsigned int)-d);
+		else
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long int n, int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0)
+			mpq_set_si((mpq_ptr)&gmp_rep,-n, (long unsigned int)-d);
+		else
+			mpq_set_si((mpq_ptr)&gmp_rep,n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long unsigned int n, int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0) {
+			mpq_set_ui((mpq_ptr)&gmp_rep,n, (long unsigned int)-d);
+			negin(*this);
+		}
+		else
+			mpq_set_ui((mpq_ptr)&gmp_rep,n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( int n, unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep,(long int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( int n, long int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0 )
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)-n, (long unsigned int)-d);
+		else
+			mpq_set_si((mpq_ptr)&gmp_rep,(long int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( int n, long unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep,(long int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	// U
+	Rationel::Rationel( unsigned int n, unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep,(long unsigned int)n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( unsigned int n, long unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep,(long unsigned int)n, d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( unsigned int n, long int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0) {
+			mpq_set_si((mpq_ptr)&gmp_rep,(long unsigned int)-n, (long unsigned int)-d);
+		}
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long int n, unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep, n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long unsigned int n, unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep, n, (long unsigned int)d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	// L
+	Rationel::Rationel( long int n, long int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0)
+			mpq_set_si((mpq_ptr)&gmp_rep, -n, (long unsigned int)-d);
+		else
+			mpq_set_si((mpq_ptr)&gmp_rep, n, (long unsigned int)d);
+
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long int n, long unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_si((mpq_ptr)&gmp_rep, n, d);
+
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	Rationel::Rationel( long unsigned int n, long int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		if (d < 0) {
+			mpq_set_ui((mpq_ptr)&gmp_rep, (long unsigned int)n, (long unsigned int)-d);
+			negin(*this);
+		}
+		else
+			mpq_set_ui((mpq_ptr)&gmp_rep, (long unsigned int)n, (long unsigned int)d);
+
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+	// UL
+	Rationel::Rationel( long unsigned int n, long unsigned int d,
+			    enum reduceFlag red)
+	{
+		assert(nonZero(d));
+		mpq_init((mpq_ptr)&gmp_rep);
+		mpq_set_ui((mpq_ptr)&gmp_rep,n, d);
+		if (red == Reduce)
+			reduce();
+
+		num = mpq_numref((mpq_ptr)&gmp_rep) ;
+		den = mpq_denref((mpq_ptr)&gmp_rep) ;
+
+	}
+
+
+
+
+}
+#endif // __GMPplusplus_rat_cstor_C__
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat_io.C b/src/kernel/gmp++/gmp++_rat_io.C
new file mode 100644
index 0000000..68f6f28
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat_io.C
@@ -0,0 +1,93 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_io.C,v $
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors:  B. Boyer
+// $Id: gmp++_int_io.C,v 1.7 2011-09-17 14:28:22 bboyer Exp $
+// ==========================================================================
+// Description:
+
+#ifndef __GIVARO_gmpxx_gmpxx_rat_io_C
+#define __GIVARO_gmpxx_gmpxx_rat_io_C
+#include <iostream>
+#include <stdlib.h>
+#include <sstream>
+#ifndef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++.h"
+#endif
+
+namespace Givaro {
+
+	// Sortie nonsignee : 321321 meme si n = -321321, par exemple
+	std::ostream& absOutput(std::ostream &o, const Rationel &n)
+	{
+		mpq_out_str(reinterpret_cast<FILE*>(&o),10,(mpq_srcptr)abs(n).get_mpq());
+		return o;
+	}
+
+	// Sortie signee : +321321 ou -321321, par exemple
+	std::ostream& Rationel::print(std::ostream &o) const
+	{
+		// mpq_out_str(reinterpret_cast<FILE*>(&o),10,(mpq_srcptr)&gmp_rep);
+		// return o;
+
+		return o << (mpq_srcptr)&gmp_rep;
+	}
+
+	Rationel::operator std::string () const
+	{
+		std::ostringstream s;
+		print(s);
+		return s.str();
+	}
+
+#if 0
+	Rationel::Rationel(const std::vector<mp_limb_t>& v)
+	{
+		size_t s = v.size();
+		if (s) {
+			mpz_init_set_ui((mpz_ptr)&gmp_rep, v[0]);
+			Integer base(256), prod, tmp;
+			prod = base = pow(base, (long unsigned)sizeof(mp_limb_t) );
+
+			std::vector<mp_limb_t>::const_iterator vi = v.begin();
+			for(++vi;vi != v.end();++vi) {
+				mpz_mul_ui( (mpz_ptr)&tmp.gmp_rep, (mpz_ptr)&prod.gmp_rep, *vi);
+				*this += tmp;
+				prod *= base;
+			}
+		} else
+			mpz_init( (mpz_ptr)&gmp_rep );
+
+	}
+
+	Rationel::operator std::vector<mp_limb_t> () const
+	{
+		size_t s = mpz_size( (mpz_srcptr)&(gmp_rep) );
+		std::vector<mp_limb_t> v(s);
+		std::vector<mp_limb_t>::iterator vi = v.begin();
+		for(mp_size_t i = 0;vi != v.end();++vi, ++i)
+			*vi = mpz_getlimbn( (mpz_srcptr)& (gmp_rep) ,i);
+		return v;
+	}
+#endif
+
+	// Entree au format de la sortie
+	std::istream& operator>> (std::istream& inp, Rationel& a)
+	{
+		return inp >>  (mpq_ptr)a.get_mpq();
+	}
+
+	std::ostream& operator<< (std::ostream& outp, const Rationel& a)
+	{
+		return a.print(outp) ;
+	}
+
+}
+
+#endif // __GIVARO_gmpxx_gmpxx_rat_io_C
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/gmp++/gmp++_rat_misc.C b/src/kernel/gmp++/gmp++_rat_misc.C
new file mode 100644
index 0000000..1bf8870
--- /dev/null
+++ b/src/kernel/gmp++/gmp++_rat_misc.C
@@ -0,0 +1,70 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/gmp++/gmp++_int_cstor.C,v $
+// Copyright(c)'1994-2011 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: B. Boyer
+// $Id: gmp++_rat_cstor.C,v 1.4 2011-09-16 14:28:22 bboyer Exp $
+// ==========================================================================
+#ifndef __GMPplusplus_rat_misc_C__
+#define __GMPplusplus_rat_misc_C__
+#include <iostream>
+#ifndef __GIVARO_INLINE_ALL
+#include "gmp++/gmp++.h"
+#endif
+
+namespace Givaro
+{
+	Integer  Rationel::getDenom() const
+	{
+		Integer d ;
+		mpq_get_den(d.get_mpz(), (mpq_srcptr)&gmp_rep);
+		return d;
+	}
+
+	Integer  Rationel::getNumer() const
+	{
+		Integer n ;
+		mpq_get_num(n.get_mpz(), (mpq_srcptr)&gmp_rep);
+		return n;
+	}
+
+	mpq_ptr Rationel::get_mpq()
+	{
+		return (mpq_ptr)&gmp_rep;
+	}
+	mpq_srcptr Rationel::get_mpq_const() const
+	{
+		return (mpq_srcptr)&gmp_rep;
+	}
+
+
+	mpz_ptr Rationel::get_mpq_den() const
+	{
+		return (mpz_ptr)den;
+	}
+
+	mpz_ptr Rationel::get_mpq_num() const
+	{
+		return (mpz_ptr)num;
+	}
+
+	Rationel& Rationel::reduce()
+	{
+		mpq_canonicalize( (mpq_ptr)&gmp_rep );
+		return *this ;
+	}
+
+	Rationel& Rationel::reduce(Rationel & r) //const
+	{
+		mpq_canonicalize( (mpq_ptr)(r.get_mpq()) );
+		return r ;
+	}
+
+}
+
+#endif // __GMPplusplus_rat_misc_C__
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/integer/Makefile.am b/src/kernel/integer/Makefile.am
index ec7d946..78719e8 100644
--- a/src/kernel/integer/Makefile.am
+++ b/src/kernel/integer/Makefile.am
@@ -27,6 +27,8 @@ pkginclude_HEADERS=         \
 
 noinst_LTLIBRARIES=libgivinteger.la
 
+EXTRA_DIST=integer.doxy
+
 libgivinteger_la_SOURCES=givintprime.C
 
 #EXTRA_DIST= integer.doxy
diff --git a/src/kernel/integer/Makefile.in b/src/kernel/integer/Makefile.in
index 4a2eb1b..1adab12 100644
--- a/src/kernel/integer/Makefile.in
+++ b/src/kernel/integer/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivinteger_la_LIBADD =
 am_libgivinteger_la_OBJECTS = givintprime.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivinteger_la_SOURCES)
 DIST_SOURCES = $(libgivinteger_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -234,6 +280,7 @@ pkginclude_HEADERS = \
 	givintrns_cstor.inl
 
 noinst_LTLIBRARIES = libgivinteger.la
+EXTRA_DIST = integer.doxy
 libgivinteger_la_SOURCES = givintprime.C
 all: all-am
 
@@ -248,9 +295,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/integer/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/integer/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/integer/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/integer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -268,6 +315,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -277,7 +325,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivinteger.la: $(libgivinteger_la_OBJECTS) $(libgivinteger_la_DEPENDENCIES) 
+libgivinteger.la: $(libgivinteger_la_OBJECTS) $(libgivinteger_la_DEPENDENCIES) $(EXTRA_libgivinteger_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivinteger_la_OBJECTS) $(libgivinteger_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -302,21 +350,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -330,7 +382,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -338,29 +390,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -381,13 +438,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -408,16 +469,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -509,6 +576,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 
 
 #EXTRA_DIST= integer.doxy
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/integer/givinteger.h b/src/kernel/integer/givinteger.h
index 7be6d98..c39d4a1 100644
--- a/src/kernel/integer/givinteger.h
+++ b/src/kernel/integer/givinteger.h
@@ -6,10 +6,15 @@
 // see the COPYRIGHT file for more details.
 // Authors: T. Gautier, J.-G. Dumas
 // =============================================================
-// Description:
-// Integer Domain class definition
+
+/*! @file givinteger.h
+ * @ingroup integers
+ * @brief Integer Domain class definition.
+ */
+
 #ifndef __GIVARO_integer_H
 #define __GIVARO_integer_H
+
 #include "givaro/givbasictype.h"
 #include "givaro/givinit.h"
 #include "givaro/giverror.h"
@@ -19,14 +24,15 @@
 
 namespace Givaro {
 	//------------------------------------ Class IntegerDom
+	//! Integer Domain.
 	class IntegerDom {
 	public:
 		typedef Integer Rep;
 		typedef Rep Element;
 
 
-		IntegerDom() : one(1UL), zero(0UL) {}
-		IntegerDom(const IntegerDom&) : one(1UL), zero(0UL) {}
+		IntegerDom() : one(1UL), mOne(-1L), zero(0UL) {}
+		IntegerDom(const IntegerDom&) : one(1UL), mOne(-1L), zero(0UL) {}
 
 		int operator==( const IntegerDom&) const
 		{
@@ -39,6 +45,7 @@ namespace Givaro {
 
 		// -- Constants:
 		const Integer one;
+		const Integer mOne;
 		const Integer zero;
 
 		// -- assignement
@@ -176,7 +183,7 @@ namespace Givaro {
 		// -- extended gcd  q = gcd(a,b) = u*a+v*b;
 		Rep& gcd( Rep& g, Rep& u, Rep& v, const Rep& a, const Rep& b ) const
 		{
-			return ::Givaro::gcd(g, a, b, u, v);
+			return ::Givaro::gcd(g, u, v, a, b);
 		}
 		Rep& gcd( Rep& g, const Rep& a, const Rep& b ) const
 		{
diff --git a/src/kernel/integer/givintfactor.h b/src/kernel/integer/givintfactor.h
index 9c8fac8..00eb148 100644
--- a/src/kernel/integer/givintfactor.h
+++ b/src/kernel/integer/givintfactor.h
@@ -4,13 +4,20 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : Prime numbers
-//              Factor sets :
-//              Pollard's rho method for factorization
-//              Elliptic curves factorization by Lenstra
 // Needs Container structures : stl ones for instance
 // Time-stamp: <29 Jun 05 14:12:09 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
+
+/*! @file givintfactor.h
+ * @ingroup integers
+ * @brief factorisation
+ *- Prime numbers
+ * - Factor sets :
+ * - Pollard's rho method for factorization
+ * - Elliptic curves factorization by Lenstra
+ * .
+ */
+
 #ifndef __GIVARO_factorisation_H
 #define __GIVARO_factorisation_H
 
@@ -31,6 +38,7 @@ namespace Givaro {
 	// Set or Container of divisors, factors.
 	// =================================================================== //
 
+	//! Integer Factor Domain.
 	template<class RandIter = GivRandom>
 	class IntFactorDom : public IntPrimeDom {
 	private:
diff --git a/src/kernel/integer/givintfactor.inl b/src/kernel/integer/givintfactor.inl
index 9edbb6e..4274f41 100644
--- a/src/kernel/integer/givintfactor.inl
+++ b/src/kernel/integer/givintfactor.inl
@@ -4,11 +4,9 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : Prime numbers
-//              Factors,
-// Needs list structures : stl ones for instance
 // Time-stamp: <06 Jun 06 15:03:59 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
+
 #ifndef __GIVARO_factorisation_INL
 #define __GIVARO_factorisation_INL
 
@@ -136,9 +134,9 @@ namespace Givaro {
 				n >>= 1;
 			while (!(n & 0x1));
 		}
-		short * Ip = new short[n+1];
+		short * Ip = new short[(size_t)n+1];
 		int i;
-		for(int ii=n+1;ii--;)
+		for(int ii=(int)n+1;ii--;)
 			Ip[ii] = 0L;
 		i=3;
 		int j, ii;
@@ -239,7 +237,6 @@ namespace Givaro {
 	//     Container<Rep> Lf;
 	//     Container<unsigned long> Le;
 	// #else
-#include <vector>
 	template<class RandIter>
 	template<class Container> Container& IntFactorDom<RandIter>::divisors( Container& L, const Rep& n)  const
 	{
diff --git a/src/kernel/integer/givintnumtheo.h b/src/kernel/integer/givintnumtheo.h
index a22ee97..cdfeba3 100644
--- a/src/kernel/integer/givintnumtheo.h
+++ b/src/kernel/integer/givintnumtheo.h
@@ -4,12 +4,19 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : Euler's phi function
-//          Primitive roots.
-//          RSA scheme.
+//
 // Time-stamp: <30 Jun 04 10:59:26 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
 
+/*! @file givintnumtheo.h
+ * @ingroup integers
+ * @brief num theory.
+ * - Euler's phi function
+ * -  Primitive roots
+ * - RSA scheme.
+ * .
+ */
+
 #ifndef __GIVARO_numtheory_H
 #define __GIVARO_numtheory_H
 
@@ -20,78 +27,83 @@
 #include "givaro/givrandom.h"
 
 namespace Givaro {
-template<class RandIter = GivRandom>
-class IntNumTheoDom : public IntFactorDom<RandIter> {
-public:
-    typedef IntFactorDom<RandIter> Father_t;
-    typedef typename IntFactorDom<RandIter>::Rep Rep;
-    IntNumTheoDom(RandIter g = RandIter())
-            :  IntFactorDom<RandIter>(g) {}
-// =================================================================== //
-// Euler's phi function
-// =================================================================== //
+	//! Num theory Domain.
+	template<class RandIter = GivRandom>
+		class IntNumTheoDom : public IntFactorDom<RandIter> {
+			public:
+				typedef IntFactorDom<RandIter> Father_t;
+				typedef typename IntFactorDom<RandIter>::Rep Rep;
+				IntNumTheoDom(RandIter g = RandIter())
+					:  IntFactorDom<RandIter>(g) {}
 
-template <template <class, class> class Container, template<class> class Alloc>
-Rep& phi(Rep& res, const Container<Rep, Alloc<Rep> >& Lf, const Rep& n) const ;
+				// =================================================================== //
+				//! Euler's phi function
+				// =================================================================== //
+				template <template <class, class> class Container, template<class> class Alloc>
+					Rep& phi(Rep& res, const Container<Rep, Alloc<Rep> >& Lf, const Rep& n) const ;
 
-Rep& phi(Rep& r, const Rep& n) const ;
+				Rep& phi(Rep& r, const Rep& n) const ;
 
-// =================================================================== //
-// Primitive Root
-// =================================================================== //
-    Rep& prim_root(Rep&, const Rep&) const ;
-    Rep& prim_root(Rep&, unsigned long&, const Rep&) const ;
-    Rep& prim_root_of_prime(Rep&, const Rep&) const ;
-    template<class Array> Rep& prim_root_of_prime(Rep& A, const Array& Lf, const Rep& phin, const Rep& n) const ;
-
-//  Polynomial-time generation of primitive roots
-//  L is number of loops of Pollard partial factorization of n-1
-//  10,000,000 gives at least 1-2^{-40} probability of success
-//  [Dubrois & Dumas, Industrial-strength primitive roots]
-//  Returns the probable primitive root and the probability of error.
-    Rep& probable_prim_root(Rep&, double&, const Rep& n, const unsigned long L = 10000000) const;
-
-//  Here L is computed so that the error is close to epsilon
-    Rep& probable_prim_root(Rep&, double&, const Rep& n, const double epsilon) const;
-
-    Rep& lowest_prim_root(Rep&, const Rep&) const ;
-    bool is_prim_root(const Rep&, const Rep&) const ;
-    Rep& order(Rep&, const Rep&, const Rep&) const ;
-    bool isorder(const Rep&, const Rep&, const Rep&) const ;
+				// =================================================================== //
+				//! Primitive Root
+				// =================================================================== //
+				Rep& prim_root(Rep&, const Rep&) const ;
+				Rep& prim_root(Rep&, unsigned long&, const Rep&) const ;
+				Rep& prim_root_of_prime(Rep&, const Rep&) const ;
+				template<class Array> Rep& prim_root_of_prime(Rep& A, const Array& Lf, const Rep& phin, const Rep& n) const ;
 
-// =================================================================== //
-// Generalization of primitive roots for any modulus
-// Primitive means maximal order
-//    Primitive Element, Primitive invertible
-//    Both functions coïncides except for m=8
-//
-// Lambda Function : maximal orbit size
-//    lambda : Order of a primitive Element
-//    lambda_inv : Order of an invertible primitive Element
-//    Both functions coïncides except for m=8
-// =================================================================== //
-    Rep& prim_inv(Rep & , const Rep&) const ;
-    Rep& prim_elem(Rep & , const Rep&) const ;
-private:
-    Rep& prim_base(Rep & , const Rep&) const ;
-    Rep& lambda_base(Rep & , const Rep&) const ;
-public:
-    Rep& lambda_primpow(Rep & , const Rep&, unsigned long) const ;
-    Rep& lambda_inv_primpow(Rep & , const Rep&, unsigned long) const ;
-    Rep& lambda(Rep & , const Rep&) const ;
-    Rep& lambda_inv(Rep & , const Rep&) const ;
+				/**  Polynomial-time generation of primitive roots.
+				*  L is number of loops of Pollard partial factorization of n-1
+				*  10,000,000 gives at least 1-2^{-40} probability of success
+				*  [Dubrois & Dumas, Industrial-strength primitive roots]
+				*  Returns the probable primitive root and the probability of error.
+				*/
+				Rep& probable_prim_root(Rep&, double&, const Rep& n, const unsigned long L = 10000000) const;
 
-// =================================================================== //
-// Möbius function
-// =================================================================== //
+				//!  Here L is computed so that the error is close to epsilon
+				Rep& probable_prim_root(Rep&, double&, const Rep& n, const double epsilon) const;
 
-template< template<class, class> class Container, template <class> class Alloc>
-short mobius(const Container<Rep, Alloc<Rep> >& lpow) const ;
+				Rep& lowest_prim_root(Rep&, const Rep&) const ;
+				bool is_prim_root(const Rep&, const Rep&) const ;
+				Rep& order(Rep&, const Rep&, const Rep&) const ;
+				bool isorder(const Rep&, const Rep&, const Rep&) const ;
 
-short mobius(const Rep& a) const;
-};
+				// =================================================================== //
+				/** Generalization of primitive roots for any modulus
+				 * Primitive means maximal order
+				 *    Primitive Element, Primitive invertible
+				 *    Both functions coïncides except for m=8
+				 *
+				 * Lambda Function : maximal orbit size
+				 *    lambda : Order of a primitive Element
+				 *    lambda_inv : Order of an invertible primitive Element
+				 *    Both functions coïncides except for m=8
+				 */
+				// =================================================================== //
+				Rep& prim_inv(Rep & , const Rep&) const ;
+				Rep& prim_elem(Rep & , const Rep&) const ;
+			private:
+				Rep& prim_base(Rep & , const Rep&) const ;
+				Rep& lambda_base(Rep & , const Rep&) const ;
+			public:
+				Rep& lambda_primpow(Rep & , const Rep&, unsigned long) const ;
+				Rep& lambda_inv_primpow(Rep & , const Rep&, unsigned long) const ;
+				Rep& lambda(Rep & , const Rep&) const ;
+				Rep& lambda_inv(Rep & , const Rep&) const ;
+
+				// =================================================================== //
+				//! Möbius function
+				// =================================================================== //
+				template< template<class, class> class Container, template <class> class Alloc>
+					short mobius(const Container<Rep, Alloc<Rep> >& lpow) const ;
+
+				//! Möbius function
+				short mobius(const Rep& a) const;
+		};
 
 } // givaro
 #include "givaro/givintnumtheo.inl"
 
 #endif // __GIVARO_numtheory_H
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/integer/givintnumtheo.inl b/src/kernel/integer/givintnumtheo.inl
index c050da2..23e1c1c 100644
--- a/src/kernel/integer/givintnumtheo.inl
+++ b/src/kernel/integer/givintnumtheo.inl
@@ -20,6 +20,11 @@
 #include "givaro/givintrns.h"
 #include "givaro/givpower.h"
 
+#ifndef GIVABSDIFF
+#define GIVABSDIFF(a,b) ((a)<(b)?((b)-(a)):((a)-(b)))
+#endif
+#include <math.h>
+
 namespace Givaro {
 
 	// =================================================================== //
@@ -28,8 +33,8 @@ namespace Givaro {
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::phi(Rep& res, const Rep& n) const
 	{
-		if (isleq(n,1)) return res=n;
-		if (isleq(n,3)) return sub(res,n,this->one);
+		if (Rep::isleq(n,1)) return res=n;
+		if (Rep::isleq(n,3)) return Rep::sub(res,n,this->one);
 		std::list<Rep> Lf;
 		Father_t::set(Lf,n);
 		//return phi (res,Lf,n);
@@ -41,11 +46,11 @@ namespace Givaro {
 	template< template<class, class> class Container, template<class> class Alloc>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::phi(Rep& res, const Container<Rep, Alloc<Rep> >& Lf, const Rep& n) const
 	{
-		if (isleq(n,1)) return res=n;
-		if (isleq(n,3)) return sub(res,n,this->one);
+		if (Rep::isleq(n,1)) return res=n;
+		if (Rep::isleq(n,3)) return Rep::sub(res,n,this->one);
 		res = n; Rep t,m;
 		for(typename Container<Rep, Alloc<Rep> >::const_iterator f=Lf.begin(); f!=Lf.end(); ++f)
-			mul(res, divexact(t,res,*f), sub(m, *f, this->one));
+			Rep::mul(res, Rep::divexact(t,res,*f), Rep::sub(m, *f, this->one));
 		return res;
 	}
 
@@ -95,26 +100,35 @@ namespace Givaro {
 		// n must be in {2,4,p^m,2p^m} where p is an odd prime
 		// else infinite loop
 
-		if (isleq(n,4)) return sub(A,n,this->one);
-		if (isZero(mod(A,n,4))) return A=this->zero;
+		if (Rep::isleq(n,4))
+			return this->sub(A,n,this->one);
+		if (this->isZero(this->mod(A,n,4)))
+			return A=this->zero;
 		Rep p,ismod2, q, no2, root;
-		if (isZero(mod(ismod2,n,2))) divexact(no2,n,2); else no2=n;
+		if (isZero(this->mod(ismod2,n,2)))
+			this->divexact(no2,n,2);
+		else
+			no2=n;
 		p=no2;
 		int k = 1;
-		while (! isprime(p) ) {
+		while (! this->isprime(p) ) {
 			sqrt(root, p);
-			while (mul(q,root,root) == p) {
+			while (this->mul(q,root,root) == p) {
 				p = root;
 				sqrt(root,p);
 			}
-			if (! isprime(p) ) {
+			if (! this->isprime(p) ) {
 				q=p;
-				while( p == q ) factor(p, q);
-				divin(q,p);
+				while( p == q )
+					this->factor(p, q);
+				this->divin(q,p);
 				if (q < p) p = q;
 			}
 		}
-		if (isZero(ismod2)) mul(q,p,2); else q=p;
+		if (isZero(ismod2))
+		       	this->mul(q,p,2);
+	       	else
+		       	q=p;
 		for(;q != n;++k,q*=p) ;
 		Rep phin, tmp;
 		phi(phin,p);
@@ -149,21 +163,21 @@ namespace Givaro {
 		while (! found) {
 			do {
 				this->random(this->_g, A, p);
-				addin( modin(A,sub(tmp,p,7)) , 7);
+				this->addin( this->modin(A,this->sub(tmp,p,7)) , 7);
 			} while ( ! isOne(gcd(tmp,A,p)) );
 			found = (int) ++runs;
 			for(f=Lf.begin();(f!=Lf.end() && found);f++)
 				found = (! isOne( this->powmod(tmp,A,*f,p)) );
 		}
 		if (k == 1) {
-			if (isZero(ismod2) && isZero(mod(ismod2, A, 2)))
+			if (isZero(ismod2) && isZero(this->mod(ismod2, A, 2)))
 				return A+=p;
 			else
 				return A;
 		} else {
 			if (! is_prim_root(A,no2))
 				A+=p;
-			if (isZero(ismod2) && isZero(mod(ismod2, A, 2)))
+			if (isZero(ismod2) && isZero(this->mod(ismod2, A, 2)))
 				return A+=no2;
 			else
 				return A;
@@ -221,18 +235,18 @@ namespace Givaro {
 			Lq.pop_back();
 			this->div(Temp, pmun, Q);
 			do {
-				nonzerorandom(this->_g, alea, p);
-				modin(alea, p);
+				this->nonzerorandom(this->_g, alea, p);
+				this->modin(alea, p);
 				this->powmod(essai, alea, Temp, p);
 				//std::cerr << alea << " should be of order " << Q << " mod " << p << std::endl;
 			} while (essai == 1);
 			// looking for alea, of order Q with high probability
 
-			mulin(primroot, essai);
+			this->mulin(primroot, essai);
 
 			//  1-(1+2/(p-1))*(1-1/L^2)^log_B(Q)  < 1-(1+2^(-log_2(p)))*(1-1/L^2)^log_B(Q);
 			essai = L;
-			mul(Temp, essai, L);
+			this->mul(Temp, essai, L);
 			error = 1-1.0/(double)Temp;
 			error = power(error, logp(Q,Temp) );
 			error *= (1.0+1.0/((double)Q-1.0));
@@ -245,8 +259,8 @@ namespace Givaro {
 		for ( ; Lqi != Lq.end(); ++Lqi, ++ei) {
 			this->div(Temp, pmun, *Lqi);
 			do {
-				nonzerorandom(this->_g, alea, p);
-				modin(alea, p);
+				this->nonzerorandom(this->_g, alea, p);
+				this->modin(alea, p);
 				this->powmod(essai, alea, Temp, p);
 				//std::cerr << alea << " should be of order at least " << *Lqi << "^" << *ei << "==" << power(*Lqi,*ei) << " mod " << p << std::endl;
 			} while( essai == 1 ) ;
@@ -256,19 +270,15 @@ namespace Givaro {
 			//std::cerr << alea << " is of order at least " << (*Lqi) << "^" << (*ei) << "==" << power(*Lqi,*ei) << " mod " << p << std::endl;
 
 			this->divin(Temp, power(*Lqi,*ei-1));
-			mulin(primroot, this->powmod(essai, alea, Temp, p));
+			this->mulin(primroot, this->powmod(essai, alea, Temp, p));
 		}
 
-		modin(primroot, p);
+		this->modin(primroot, p);
 
 		return primroot;
 		// return primroot with high probability
 	}
 
-#ifndef GIVABSDIFF
-#define GIVABSDIFF(a,b) ((a)<(b)?((b)-(a)):((a)-(b)))
-#endif
-#include <math.h>
 
 	//  Here L is computed so that the error is close to epsilon
 	// Newton-Raphson iteration is used for
@@ -317,7 +327,8 @@ namespace Givaro {
 	{
 
 		std::vector<Rep> Lf;
-		Rep phin; sub(phin,n,this->one);
+		Rep phin;
+		this->sub(phin,n,this->one);
 		Father_t::set(Lf,phin);
 		return prim_root_of_prime(A, Lf, phin, n);
 	}
@@ -350,17 +361,21 @@ namespace Givaro {
 
 		Rep primeorder;
 
-		for(bool exemp = true; exemp; nextprimein(prime) ) {
+		for(bool exemp = true; exemp; this->nextprimein(prime) ) {
 			A = prime;
 			primeorder = phin;
 			for(typename Array::const_iterator f = Lf.begin(); f != Lf.end(); ++f) {
 				this->powmod(tmp, prime, this->div(expo, primeorder, *f), n);
 				if (isOne(tmp)) {
 					newLf.push_back(*f);
-					while (isZero(mod(tmp,expo,*f)) && isOne( this->powmod(tmp, prime, this->div(temp, expo, *f), n) ) ) { expo = temp; }
+					while (isZero(this->mod(tmp,expo,*f)) &&
+					       isOne( this->powmod(tmp, prime, this->div(temp, expo, *f), n) ) ) {
+					       	expo = temp;
+					}
 					primeorder = expo;
 					//                 std::cerr << "2 Order (Div): " << primeorder << std::endl;
-				} else {
+				}
+			       	else {
 					oldLf.push_back(*f);
 					exemp = false;
 					//                 std::cerr << "2 Order : " << primeorder << std::endl;
@@ -377,7 +392,7 @@ namespace Givaro {
 		//     std::cerr << "Root : " << A << std::endl;
 		//     std::cerr << "Order : " << Aorder << std::endl;
 
-		for ( ; islt(Aorder,phin); nextprimein(prime) ) {
+		for ( ; this->islt(Aorder,phin); this->nextprimein(prime) ) {
 			newLf.resize(0); oldLf.resize(0);
 
 			for(typename Array::const_iterator f = Lf.begin(); f != Lf.end(); ++f) {
@@ -399,9 +414,9 @@ namespace Givaro {
 
 				this->powmod(tmp, prime, g, n);
 
-				modin( mulin(A, tmp), n );
+				this->modin( this->mulin(A, tmp), n );
 
-				mulin(Aorder, this->div(tmp, phin, g));
+				this->mulin(Aorder, this->div(tmp, phin, g));
 
 				Lf = newLf;
 			}
@@ -423,8 +438,8 @@ namespace Givaro {
 	{
 		// n must be in {2,4,p^m,2p^m} where p is an odd prime
 		// else returns zero
-		if (isleq(n,4)) return sub(A,n,this->one);
-		if (isZero(mod(A,n,4))) return A=this->zero;
+		if (Rep::isleq(n,4)) return Rep::sub(A,n,this->one);
+		if (isZero(Rep::mod(A,n,4UL))) return A=this->zero;
 		Rep phin, tmp;
 		phi(phin,n);
 		std::list<Rep> Lf;
@@ -433,15 +448,15 @@ namespace Givaro {
 		for(f=Lf.begin();f!=Lf.end();++f)
 			this->div(*f,phin,*f);
 		int found=0;
-		for(A = 2;(isleq(A,n) && (! found));addin(A,1)) {
+		for(A = 2;(Rep::isleq(A,n) && (! found)); Rep::addin(A,1UL)) {
 			if (isOne(gcd(tmp,A,n))) {
 				found = 1;
 				for(f=Lf.begin();(f!=Lf.end() && found);f++)
 					found = (! isOne( this->powmod(tmp,A,*f,n)) );
 			}
 		}
-		if (isleq(A,n))
-			return subin(A,1);
+		if (Rep::isleq(A,n))
+			return Rep::subin(A,1UL);
 		else
 			return A=this->zero;
 	}
@@ -456,7 +471,8 @@ namespace Givaro {
 		std::list<Rep> Lf;
 		Father_t::set(Lf,phin);
 		typename std::list<Rep>::iterator f=Lf.begin();
-		Rep A; mod(A,p,n);
+		Rep A;
+		this->mod(A,p,n);
 		if (isOne(gcd(tmp,A,n))) {
 			found = true;
 			for(;(f!=Lf.end() && found);f++) {
@@ -472,14 +488,15 @@ namespace Givaro {
 	{
 		// returns 1 if p is of order g in Z/nZ
 		Rep tmp;
-		return (isOne( this->powmod(tmp, p, g, n) ) && areEqual( g, order(tmp,p,n) ) );
+		return (this->isOne( this->powmod(tmp, p, g, n) ) && this->areEqual( g, order(tmp,p,n) ) );
 	}
 
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::order(Rep& g, const Rep& p, const Rep& n) const
 	{
 		// returns 0 if failed
-		Rep A; mod(A,p,n);
+		Rep A;
+		this->mod(A,p,n);
 		if (isZero(A))
 			return g = this->zero;
 		if (isOne(A))
@@ -498,7 +515,7 @@ namespace Givaro {
 					break;
 			if (noprimroot) {
 				for(;f!=Lf.end();++f)
-					while (isZero(mod(tmp,g,*f)) && isOne(  this->powmod(tmp,A,  this->div(gg,g,*f),n) ) )
+					while (isZero(this->mod(tmp,g,*f)) && isOne(  this->powmod(tmp,A,  this->div(gg,g,*f),n) ) )
 						g = gg;
 				return g;
 			} else
@@ -510,7 +527,7 @@ namespace Givaro {
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::prim_inv(Rep& A, const Rep& n) const
 	{
-		if (isleq(n,4)) return sub(A,n,this->one);
+		if (Rep::isleq(n,4)) return sub(A,n,this->one);
 		if (areEqual(n,8)) return init(A,3);
 		return prim_base(A, n);
 	}
@@ -518,12 +535,13 @@ namespace Givaro {
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::prim_elem(Rep& A, const Rep& n) const
 	{
-		if (isleq(n,4)) {
+		if (Rep::isleq(n,4)) {
 			Rep tmp;
 			return this->sub(A,n,this->one);
 		}
 
-		if (areEqual(n,8)) return init(A,2);
+		if (this->areEqual(n,8))
+			return this->init(A,2);
 		return prim_base(A, n);
 	}
 
@@ -542,9 +560,9 @@ namespace Givaro {
 		typename std::vector<Rep>::iterator pe = Pe.begin();
 		typename std::vector<Rep>::iterator a = Ra.begin() ;
 		for( ;p!=Lp.end();++p, ++e, ++pe, ++a) {
-			dom_power( *pe, *p, *e, *this);
-			if (areEqual(*p,2))
-				init(*a, 3);
+			dom_power( *pe, *p, (long)*e, *this);
+			if (this->areEqual(*p,2))
+				this->init(*a, 3);
 			else
 				prim_root(*a, *pe);
 		}
@@ -573,13 +591,17 @@ namespace Givaro {
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::lambda_inv_primpow(Rep & z, const Rep& p, const unsigned long e) const
 	{
 		// Prerequisite : p prime.
-		if (areEqual(p, 2)) {
-			if (e<=2) return init(z,e);
-			if (e==3) return init(z,2);
-			return dom_power(z, p, e-2, *this);
-		} else {
+		if (this->areEqual(p, 2)) {
+			if (e<=2)
+				return this->init(z,e);
+			if (e==3)
+				return this->init(z,2);
+			return dom_power(z, p, (long)e-2, *this);
+		}
+		else {
 			Rep tmp;
-			return mulin( dom_power(z, p, e-1, *this), sub(tmp, p, this->one) );
+			return this->mulin( dom_power(z, p, (long)e-1, *this),
+					    this->sub(tmp, p, this->one) );
 		}
 	}
 
@@ -589,17 +611,22 @@ namespace Givaro {
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::lambda_inv(Rep & z, const Rep& m) const
 	{
-		if (areEqual(m,2)) return init(z,1);
-		if (areEqual(m,3) || areEqual(m,4) || areEqual(m,8) ) return init(z,2);
+		if (this->areEqual(m,2))
+			return this->init(z,1);
+		if (this->areEqual(m,3) || this->areEqual(m,4) || this->areEqual(m,8) )
+			return this->init(z,2);
 		return lambda_base(z, m);
 	}
 
 	template<class RandIter>
 	typename IntNumTheoDom<RandIter>::Rep& IntNumTheoDom<RandIter>::lambda(Rep & z, const Rep& m) const
 	{
-		if (areEqual(m,2)) return init(z,1);
-		if (areEqual(m,3) || areEqual(m,4)) return init(z,2);
-		if (areEqual(m,8) ) return init(z,3);
+		if (this->areEqual(m,2))
+			return this->init(z,1);
+		if (this->areEqual(m,3) || this->areEqual(m,4))
+			return this->init(z,2);
+		if (this->areEqual(m,8) )
+			return this->init(z,3);
 		return lambda_base(z, m);
 	}
 
@@ -624,7 +651,7 @@ namespace Givaro {
 			//            Rep g;
 			//            gcd(g, z, tmp);
 			//            mulin(z, this->divin(tmp, g));
-			lcmin(z,tmp);
+			this->lcmin(z,tmp);
 		}
 
 		return z;
diff --git a/src/kernel/integer/givintprime.C b/src/kernel/integer/givintprime.C
index 4178f25..ed2f952 100644
--- a/src/kernel/integer/givintprime.C
+++ b/src/kernel/integer/givintprime.C
@@ -11,6 +11,10 @@
 //                      (There are parameters to fix)
 // Time-stamp: <06 Jun 06 15:21:09 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
+//
+#ifndef __GIVARO_integer_givintprime_C
+#define __GIVARO_integer_givintprime_C
+
 #include <math.h>
 #include "givaro/givintprime.h"
 #include "givaro/givtimer.h"
@@ -21,162 +25,171 @@
 
 namespace Givaro {
 
-FermatDom::Rep& FermatDom::fermat(Rep& f,  const long  n ) const
-{
-        // fermat(n) = 2^(2^n) + 1
-    Rep z;
-    assign(z,2);
-    pow(f,z, 1 << n);
-    return addin(f,one);
-}
-
-int FermatDom::pepin (const long n) const
-{
-        // Fermat number primality test
-    Rep fn;
-    fermat(fn,n);
-    Rep y,z,t;
-    sub(z,fn,one);
-    assign(t,2);
-    divin(z,t);
-    assign(t,3);
-    powmod(y,t,z,fn);
-    subin(fn,y);
-    return isOne(fn);
-}
+	FermatDom::Rep& FermatDom::fermat(Rep& f,  const long  n ) const
+	{
+		// fermat(n) = 2^(2^n) + 1
+		Rep z;
+		assign(z,2);
+		pow(f,z, 1 << n);
+		return addin(f,one);
+	}
 
+	int FermatDom::pepin (const long n) const
+	{
+		// Fermat number primality test
+		Rep fn;
+		fermat(fn,n);
+		Rep y,z,t;
+		sub(z,fn,one);
+		assign(t,2);
+		divin(z,t);
+		assign(t,3);
+		powmod(y,t,z,fn);
+		subin(fn,y);
+		return isOne(fn);
+	}
 
-// =================================================================== //
-// Primality tests
-// =================================================================== //
-IntPrimeDom::Rep& IntPrimeDom::nextprimein(Rep& n, int r)  const {
-    if (isleq( n,1)) return n=2;
-    Rep tmp;
-    mod( tmp, n, 2UL);
-    if ( isZero(tmp) )
-        addin(n,1);
-    else
-        addin(n,2);
-    while (! isprime(n,r) )
-        addin(n,2);
-    return n;
-}
-
-IntPrimeDom::Rep& IntPrimeDom::nextprime(Rep& n, const Rep& p, int r)  const {
-    if (isleq( p,1)) return n=2;
-    if (&n == &p) return nextprimein(n,r);
-    if (isZero( mod(n,p,2)))
-        add(n,p,1);
-    else
-        add(n,p,2);
-    while (! isprime(n,r) )
-        addin(n,2);
-
-    return n;
-}
-
-IntPrimeDom::Rep& IntPrimeDom::prevprimein(Rep& n, int r)  const {
-    if (isleq( n,2)) return n=2;
-    Rep tmp;
-    mod(tmp, n, 2UL);
-    if (isZero(tmp) )
-        subin(n,1);
-    else
-        subin(n,2);
-    while (! isprime(n,r) )
-        subin(n,2);
-    return n;
-}
-
-IntPrimeDom::Rep& IntPrimeDom::prevprime(Rep& n, const Rep& p, int r)  const {
-    if (isleq( p,2)) return n=2;
-    if (&n == &p) return prevprimein(n,r);
-    if (isZero( mod(n,p,2)) )
-        sub(n,p,1);
-    else
-        sub(n,p,2);
-    while (! isprime(n,r) )
-        subin(n,2);
-    return n;
-}
-
-
-int IntPrimeDom::IP2[LOGMAX2+5] = {-1,-1,32749,32771,32779,32783,32789,32797,32801,32803,32831,32833,32839,32843,32869,32887,32909,32911,32917,32933,32939,32941,32957,32969,32971,32983,32987,32993,32999,33013,33023,33029,33037,33049,33053,33071,33073,33083,33091,33107,33113,33119,33149,33151,33161,33179,33181,33191,33199,33203,33211,33223,33247,33287,33289,33301,33311,33317,33329,33331,33343,33347,33349,33353,33359,33377,33391,33403,33409,33413,33427,33457,33461,33469,33479,33487,33493,33503,33521,33529,33533,33547,33563,33569,33577,33581,33587,33589,33599,33601,33613,33617,33619,33623,33629,33637,33641,33647,33679,33703,33713,33721,33739,33749,33751,33757,33767,33769,33773,33791,33797,33809,33811,33827,33829,33851,33857,33863,33871,33889,33893,33911,33923,33931,33937,33941,33961,33967,33997,34019,34031,34033,34039,34057,34061,34123,34127,34129,34141,34147,34157,34159,34171,34183,34211,34213,34217,34231,34253,34259,34261,34267,34273,34283,34297,34301,34303,34313,34319,34327,34337,34351,34361,34367,34369,34381,34403,34421,34429,34439,34457,34469,34471,34483,34487,34499,34501,34511,34513,34519,34537,34543,34549,34583,34589,34591,34603,34607,34613,34631,34649,34651,34667,34673,34679,34687,34693,34703,34721,34729,34739,34747,34757,34759,34763,34781,34807,34819,34841,34843,34847,34849,34871,34877,34883,34897,34913,34919,34939,34949,34961,34963,34981,35023,35027,35051,35053,35059,35069,35081,35083,35089,35099,35107,35111,35117,35129,35141,35149,35153,35159,35171,35201,35221,35227,35251,35257,35267,35279,35281,35291,35311,35317,35323,35327,35339,35353,35363,35381,35393,35401,35407,35419,35423,35437,35447,35449,35461,35491,35507,35509,35521,35527,35531,35533,35537,35543,35569,35573,35591,35593,35597,35603,35617,35671,35677,35729,35731,35747,35753,35759,35771,35797,35801,35803,35809,35831,35837,35839,35851,35863,35869,35879,35897,35899,35911,35923,35933,35951,35963,35969,35977,35983,35993,35999,36007,36011,36013,36017,36037,36061,36067,36073,36083,36097,36107,36109,36131,36137,36151,36161,36187,36191,36209,36217,36229,36241,36251,36263,36269,36277,36293,36299,36307,36313,36319,36341,36343,36353,36373,36383,36389,36433,36451,36457,36467,36469,36473,36479,36493,36497,36523,36527,36529,36541,36551,36559,36563,36571,36583,36587,36599,36607,36629,36637,36643,36653,36671,36677,36683,36691,36697,36709,36713,36721,36739,36749,36761,36767,36779,36781,36787,36791,36793,36809,36821,36833,36847,36857,36871,36877,36887,36899,36901,36913,36919,36923,36929,36931,36943,36947,36973,36979,36997,37003,37013,37019,37021,37039,37049,37057,37061,37087,37097,37117,37123,37139,37159,37171,37181,37189,37199,37201,37217,37223,37243,37253,37273,37277,37307,37309,37313,37321,37337,37339,37357,37361,37363,37369,37379,37397,37409,37423,37441,37447,37463,37483,37489,37493,37501,37507,37511,37517,37529,37537,37547,37549,37561,37567,37571,37573,37579,37589,37591,37607,37619,37633,37643,37649,37657,37663,37691,37693,37699,37717,37747,37781,37783,37799,37811,37813,37831,37847,37853,37861,37871,37879,37889,37897,37907,37951,37957,37963,37967,37987,37991,37993,37997,38011,38039,38047,38053,38069,38083,38113,38119,38149,38153,38167,38177,38183,38189,38197,38201,38219,38231,38237,38239,38261,38273,38281,38287,38299,38303,38317,38321,38327,38329,38333,38351,38371,38377,38393,38431,38447,38449,38453,38459,38461,38501,38543,38557,38561,38567,38569,38593,38603,38609,38611,38629,38639,38651,38653,38669,38671,38677,38693,38699,38707,38711,38713,38723,38729,38737,38747,38749,38767,38783,38791,38803,38821,38833,38839,38851,38861,38867,38873,38891,38903,38917,38921,38923,38933,38953,38959,38971,38977,38993,39019,39023,39041,39043,39047,39079,39089,39097,39103,39107,39113,39119,39133,39139,39157,39161,39163,39181,39191,39199,39209,39217,39227,39229,39233,39239,39241,39251,39293,39301,39313,39317,39323,39341,39343,39359,39367,39371,39373,39383,39397,39409,39419,39439,39443,39451,39461,39499,39503,39509,39511,39521,39541,39551,39563,39569,39581,39607,39619,39623,39631,39659,39667,39671,39679,39703,39709,39719,39727,39733,39749,39761,39769,39779,39791,39799,39821,39827,39829,39839,39841,39847,39857,39863,39869,39877,39883,39887,39901,39929,39937,39953,39971,39979,39983,39989,40009,40013,40031,40037,40039,40063,40087,40093,40099,40111,40123,40127,40129,40151,40153,40163,40169,40177,40189,40193,40213,40231,40237,40241,40253,40277,40283,40289,40343,40351,40357,40361,40387,40423,40427,40429,40433,40459,40471,40483,40487,40493,40499,40507,40519,40529,40531,40543,40559,40577,40583,40591,40597,40609,40627,40637,40639,40693,40697,40699,40709,40739,40751,40759,40763,40771,40787,40801,40813,40819,40823,40829,40841,40847,40849,40853,40867,40879,40883,40897,40903,40927,40933,40939,40949,40961,40973,40993,41011,41017,41023,41039,41047,41051,41057,41077,41081,41113,41117,41131,41141,41143,41149,41161,41177,41179,41183,41189,41201,41203,41213,41221,41227,41231,41233,41243,41257,41263,41269,41281,41299,41333,41341,41351,41357,41381,41387,41389,41399,41411,41413,41443,41453,41467,41479,41491,41507,41513,41519,41521,41539,41543,41549,41579,41593,41597,41603,41609,41611,41617,41621,41627,41641,41647,41651,41659,41669,41681,41687,41719,41729,41737,41759,41761,41771,41777,41801,41809,41813,41843,41849,41851,41863,41879,41887,41893,41897,41903,41911,41927,41941,41947,41953,41957,41959,41969,41981,41983,41999,42013,42017,42019,42023,42043,42061,42071,42073,42083,42089,42101,42131,42139,42157,42169,42179,42181,42187,42193,42197,42209,42221,42223,42227,42239,42257,42281,42283,42293,42299,42307,42323,42331,42337,42349,42359,42373,42379,42391,42397,42403,42407,42409,42433,42437,42443,42451,42457,42461,42463,42467,42473,42487,42491,42499,42509,42533,42557,42569,42571,42577,42589,42611,42641,42643,42649,42667,42677,42683,42689,42697,42701,42703,42709,42719,42727,42737,42743,42751,42767,42773,42787,42793,42797,42821,42829,42839,42841,42853,42859,42863,42899,42901,42923,42929,42937,42943,42953,42961,42967,42979,42989,43003,43013,43019,43037,43049,43051,43063,43067,43093,43103,43117,43133,43151,43159,43177,43189,43201,43207,43223,43237,43261,43271,43283,43291,43313,43319,43321,43331,43391,43397,43399,43403,43411,43427,43441,43451,43457,43481,43487,43499,43517,43541,43543,43573,43577,43579,43591,43597,43607,43609,43613,43627,43633,43649,43651,43661,43669,43691,43711,43717,43721,43753,43759,43777,43781,43783,43787,43789,43793,43801,43853,43867,43889,43891,43913,43933,43943,43951,43961,43963,43969,43973,43987,43991,43997,44017,44021,44027,44029,44041,44053,44059,44071,44087,44089,44101,44111,44119,44123,44129,44131,44159,44171,44179,44189,44201,44203,44207,44221,44249,44257,44263,44267,44269,44273,44279,44281,44293,44351,44357,44371,44381,44383,44389,44417,44449,44453,44483,44491,44497,44501,44507,44519,44531,44533,44537,44543,44549,44563,44579,44587,44617,44621,44623,44633,44641,44647,44651,44657,44683,44687,44699,44701,44711,44729,44741,44753,44771,44773,44777,44789,44797,44809,44819,44839,44843,44851,44867,44879,44887,44893,44909,44917,44927,44939,44953,44959,44963,44971,44983,44987,45007,45013,45053,45061,45077,45083,45119,45121,45127,45131,45137,45139,45161,45179,45181,45191,45197,45233,45247,45259,45263,45281,45289,45293,45307,45317,45319,45329,45337,45341,45343,45361,45377,45389,45403,45413,45427,45433,45439,45481,45491,45497,45503,45523,45533,45541,45553,45557,45569,45587,45589,45599,45613,45631,45641,45659,45667,45673,45677,45691,45697,45707,45737,45751,45757,45763,45767,45779,45817,45821,45823,45827,45833,45841,45853,45863,45869,45887,45893,45943,45949,45953,45959,45971,45979,45989,46021,46027,46049,46051,46061,46073,46091,46093,46099,46103,46133,46141,46147,46153,46171,46181,46183,46187,46199,46219,46229,46237,46261,46271,46273,46279,46301,46307,46309,46327,46337,46349,46351,46381,46399,46411,46439,46441,46447,46451,46457,46471,46477,46489,46499,46507,46511,46523,46549,46559,46567,46573,46589,46591,46601,46619,46633,46639,46643,46649,46663,46679,46681,46687,46691,46703,46723,46727,46747,46751,46757,46769,46771,46807,46811,46817,46819,46829,46831,46853,46861,46867,46877,46889,46901,46919,46933,46957,46993,46997,47017,47041,47051,47057,47059,47087,47093,47111,47119,47123,47129,47137,47143,47147,47149,47161,47189,47207,47221,47237,47251,47269,47279,47287,47293,47297,47303,47309,47317,47339,47351,47353,47363,47381,47387,47389,47407,47417,47419,47431,47441,47459,47491,47497,47501,47507,47513,47521,47527,47533,47543,47563,47569,47581,47591,47599,47609,47623,47629,47639,47653,47657,47659,47681,47699,47701,47711,47713,47717,47737,47741,47743,47777,47779,47791,47797,47807,47809,47819,47837,47843,47857,47869,47881,47903,47911,47917,47933,47939,47947,47951,47963,47969,47977,47981,48017,48023,48029,48049,48073,48079,48091,48109,48119,48121,48131,48157,48163,48179,48187,48193,48197,48221,48239,48247,48259,48271,48281,48299,48311,48313,48337,48341,48353,48371,48383,48397,48407,48409,48413,48437,48449,48463,48473,48479,48481,48487,48491,48497,48523,48527,48533,48539,48541,48563,48571,48589,48593,48611,48619,48623,48647,48649,48661,48673,48677,48679,48731,48733,48751,48757,48761,48767,48779,48781,48787,48799,48809,48817,48821,48823,48847,48857,48859,48869,48871,48883,48889,48907,48947,48953,48973,48989,48991,49003,49009,49019,49031,49033,49037,49043,49057,49069,49081,49103,49109,49117,49121,49123,49139,49157,49169,49171,49177,49193,49199,49201,49207,49211,49223,49253,49261,49277,49279,49297,49307,49331,49333,49339,49363,49367,49369,49391,49393,49409,49411,49417,49429,49433,49451,49459,49463,49477,49481,49499,49523,49529,49531,49537,49547,49549,49559,49597,49603,49613,49627,49633,49639,49663,49667,49669,49681,49697,49711,49727,49739,49741,49747,49757,49783,49787,49789,49801,49807,49811,49823,49831,49843,49853,49871,49877,49891,49919,49921,49927,49937,49939,49943,49957,49991,49993,49999,50021,50023,50033,50047,50051,50053,50069,50077,50087,50093,50101,50111,50119,50123,50129,50131,50147,50153,50159,50177,50207,50221,50227,50231,50261,50263,50273,50287,50291,50311,50321,50329,50333,50341,50359,50363,50377,50383,50387,50411,50417,50423,50441,50459,50461,50497,50503,50513,50527,50539,50543,50549,50551,50581,50587,50591,50593,50599,50627,50647,50651,50671,50683,50707,50723,50741,50753,50767,50773,50777,50789,50821,50833,50839,50849,50857,50867,50873,50891,50893,50909,50923,50929,50951,50957,50969,50971,50989,50993,51001,51031,51043,51047,51059,51061,51071,51109,51131,51133,51137,51151,51157,51169,51193,51197,51199,51203,51217,51229,51239,51241,51257,51263,51283,51287,51307,51329,51341,51343,51347,51349,51361,51383,51407,51413,51419,51421,51427,51431,51437,51439,51449,51461,51473,51479,51481,51487,51503,51511,51517,51521,51539,51551,51563,51577,51581,51593,51599,51607,51613,51631,51637,51647,51659,51673,51679,51683,51691,51713,51719,51721,51749,51767,51769,51787,51797,51803,51817,51827,51829,51839,51853,51859,51869,51871,51893,51899,51907,51913,51929,51941,51949,51971,51973,51977,51991,52009,52021,52027,52051,52057,52067,52069,52081,52103,52121,52127,52147,52153,52163,52177,52181,52183,52189,52201,52223,52237,52249,52253,52259,52267,52289,52291,52301,52313,52321,52361,52363,52369,52379,52387,52391,52433,52453,52457,52489,52501,52511,52517,52529,52541,52543,52553,52561,52567,52571,52579,52583,52609,52627,52631,52639,52667,52673,52691,52697,52709,52711,52721,52727,52733,52747,52757,52769,52783,52807,52813,52817,52837,52859,52861,52879,52883,52889,52901,52903,52919,52937,52951,52957,52963,52967,52973,52981,52999,53003,53017,53047,53051,53069,53077,53087,53089,53093,53101,53113,53117,53129,53147,53149,53161,53171,53173,53189,53197,53201,53231,53233,53239,53267,53269,53279,53281,53299,53309,53323,53327,53353,53359,53377,53381,53401,53407,53411,53419,53437,53441,53453,53479,53503,53507,53527,53549,53551,53569,53591,53593,53597,53609,53611,53617,53623,53629,53633,53639,53653,53657,53681,53693,53699,53717,53719,53731,53759,53773,53777,53783,53791,53813,53819,53831,53849,53857,53861,53881,53887,53891,53897,53899,53917,53923,53927,53939,53951,53959,53987,53993,54001,54011,54013,54037,54049,54059,54083,54091,54101,54121,54133,54139,54151,54163,54167,54181,54193,54217,54251,54269,54277,54287,54293,54311,54319,54323,54331,54347,54361,54367,54371,54377,54401,54403,54409,54413,54419,54421,54437,54443,54449,54469,54493,54497,54499,54503,54517,54521,54539,54541,54547,54559,54563,54577,54581,54583,54601,54617,54623,54629,54631,54647,54667,54673,54679,54709,54713,54721,54727,54751,54767,54773,54779,54787,54799,54829,54833,54851,54869,54877,54881,54907,54917,54919,54941,54949,54959,54973,54979,54983,55001,55009,55021,55049,55051,55057,55061,55073,55079,55103,55109,55117,55127,55147,55163,55171,55201,55207,55213,55217,55219,55229,55243,55249,55259,55291,55313,55331,55333,55337,55339,55343,55351,55373,55381,55399,55411,55439,55441,55457,55469,55487,55501,55511,55529,55541,55547,55579,55589,55603,55609,55619,55621,55631,55633,55639,55661,55663,55667,55673,55681,55691,55697,55711,55717,55721,55733,55763,55787,55793,55799,55807,55813,55817,55819,55823,55829,55837,55843,55849,55871,55889,55897,55901,55903,55921,55927,55931,55933,55949,55967,55987,55997,56003,56009,56039,56041,56053,56081,56087,56093,56099,56101,56113,56123,56131,56149,56167,56171,56179,56197,56207,56209,56237,56239,56249,56263,56267,56269,56299,56311,56333,56359,56369,56377,56383,56393,56401,56417,56431,56437,56443,56453,56467,56473,56477,56479,56489,56501,56503,56509,56519,56527,56531,56533,56543,56569,56591,56597,56599,56611,56629,56633,56659,56663,56671,56681,56687,56701,56711,56713,56731,56737,56747,56767,56773,56779,56783,56807,56809,56813,56821,56827,56843,56857,56873,56891,56893,56897,56909,56911,56921,56923,56929,56941,56951,56957,56963,56983,56989,56993,56999,57037,57041,57047,57059,57073,57077,57089,57097,57107,57119,57131,57139,57143,57149,57163,57173,57179,57191,57193,57203,57221,57223,57241,57251,57259,57269,57271,57283,57287,57301,57329,57331,57347,57349,57367,57373,57383,57389,57397,57413,57427,57457,57467,57487,57493,57503,57527,57529,57557,57559,57571,57587,57593,57601,57637,57641,57649,57653,57667,57679,57689,57697,57709,57713,57719,57727,57731,57737,57751,57773,57781,57787,57791,57793,57803,57809,57829,57839,57847,57853,57859,57881,57899,57901,57917,57923,57943,57947,57973,57977,57991,58013,58027,58031,58043,58049,58057,58061,58067,58073,58099,58109,58111,58129,58147,58151,58153,58169,58171,58189,58193,58199,58207,58211,58217,58229,58231,58237,58243,58271,58309,58313,58321,58337,58363,58367,58369,58379,58391,58393,58403,58411,58417,58427,58439,58441,58451,58453,58477,58481,58511,58537,58543,58549,58567,58573,58579,58601,58603,58613,58631,58657,58661,58679,58687,58693,58699,58711,58727,58733,58741,58757,58763,58771,58787,58789,58831,58889,58897,58901,58907,58909,58913,58921,58937,58943,58963,58967,58979,58991,58997,59009,59011,59021,59023,59029,59051,59053,59063,59069,59077,59083,59093,59107,59113,59119,59123,59141,59149,59159,59167,59183,59197,59207,59209,59219,59221,59233,59239,59243,59263,59273,59281,59333,59341,59351,59357,59359,59369,59377,59387,59393,59399,59407,59417,59419,59441,59443,59447,59453,59467,59471,59473,59497,59509,59513,59539,59557,59561,59567,59581,59611,59617,59621,59627,59629,59651,59659,59663,59669,59671,59693,59699,59707,59723,59729,59743,59747,59753,59771,59779,59791,59797,59809,59833,59863,59879,59887,59921,59929,59951,59957,59971,59981,59999,60013,60017,60029,60037,60041,60077,60083,60089,60091,60101,60103,60107,60127,60133,60139,60149,60161,60167,60169,60209,60217,60223,60251,60257,60259,60271,60289,60293,60317,60331,60337,60343,60353,60373,60383,60397,60413,60427,60443,60449,60457,60493,60497,60509,60521,60527,60539,60589,60601,60607,60611,60617,60623,60631,60637,60647,60649,60659,60661,60679,60689,60703,60719,60727,60733,60737,60757,60761,60763,60773,60779,60793,60811,60821,60859,60869,60887,60889,60899,60901,60913,60917,60919,60923,60937,60943,60953,60961,61001,61007,61027,61031,61043,61051,61057,61091,61099,61121,61129,61141,61151,61153,61169,61211,61223,61231,61253,61261,61283,61291,61297,61331,61333,61339,61343,61357,61363,61379,61381,61403,61409,61417,61441,61463,61469,61471,61483,61487,61493,61507,61511,61519,61543,61547,61553,61559,61561,61583,61603,61609,61613,61627,61631,61637,61643,61651,61657,61667,61673,61681,61687,61703,61717,61723,61729,61751,61757,61781,61813,61819,61837,61843,61861,61871,61879,61909,61927,61933,61949,61961,61967,61979,61981,61987,61991,62003,62011,62017,62039,62047,62053,62057,62071,62081,62099,62119,62129,62131,62137,62141,62143,62171,62189,62191,62201,62207,62213,62219,62233,62273,62297,62299,62303,62311,62323,62327,62347,62351,62383,62401,62417,62423,62459,62467,62473,62477,62483,62497,62501,62507,62533,62539,62549,62563,62581,62591,62597,62603,62617,62627,62633,62639,62653,62659,62683,62687,62701,62723,62731,62743,62753,62761,62773,62791,62801,62819,62827,62851,62861,62869,62873,62897,62903,62921,62927,62929,62939,62969,62971,62981,62983,62987,62989,63029,63031,63059,63067,63073,63079,63097,63103,63113,63127,63131,63149,63179,63197,63199,63211,63241,63247,63277,63281,63299,63311,63313,63317,63331,63337,63347,63353,63361,63367,63377,63389,63391,63397,63409,63419,63421,63439,63443,63463,63467,63473,63487,63493,63499,63521,63527,63533,63541,63559,63577,63587,63589,63599,63601,63607,63611,63617,63629,63647,63649,63659,63667,63671,63689,63691,63697,63703,63709,63719,63727,63737,63743,63761,63773,63781,63793,63799,63803,63809,63823,63839,63841,63853,63857,63863,63901,63907,63913,63929,63949,63977,63997,64007,64013,64019,64033,64037,64063,64067,64081,64091,64109,64123,64151,64153,64157,64171,64187,64189,64217,64223,64231,64237,64271,64279,64283,64301,64303,64319,64327,64333,64373,64381,64399,64403,64433,64439,64451,64453,64483,64489,64499,64513,64553,64567,64577,64579,64591,64601,64609,64613,64621,64627,64633,64661,64663,64667,64679,64693,64709,64717,64747,64763,64781,64783,64793,64811,64817,64849,64853,64871,64877,64879,64891,64901,64919,64921,64927,64937,64951,64969,64997,65003,65011,65027,65029,65033,65053,65063,65071,65089,65099,65101,65111,65119,65123,65129,65141,65147,65167,65171,65173,65179,65183,65203,65213,65239,65257,65267,65269,65287,65293,65309,65323,65327,65353,65357,65371,65381,65393,65407,65413,65419,65423,65437,65447,65449,65479,65497,65519,65521,TABMAX2,TABMAX2,TABMAX2};
-
-const int * IntPrimeDom::TP2 = &(IntPrimeDom::IP2)[2];
-
-int IntPrimeDom::isprime_Tabule2(const int n)  const {
-       int plus = LOGMAX2 >> 1;
-       int here = plus;
-       int a;
-//        int loop = LOGMAX2;
-//        while (loop) {
-       for(int loop = LOGMAX2;loop; (loop >>= 1) ) {
-           if ( (a = (TP2[here] - n)) == 0) return 1;
-           if (a > 0)
-               here -= (++plus >>= 1);
-           else
-               here += (++plus >>= 1);
-//            loop >>= 1;
-       }
-       return 0;
-}
-
-
-int IntPrimeDom::IP[LOGMAX+5] = {-1,-1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973,10007,10009,10037,10039,10061,10067,10069,10079,10091,10093,10099,10103,10111,10133,10139,10141,10151,10159,10163,10169,10177,10181,10193,10211,10223,10243,10247,10253,10259,10267,10271,10273,10289,10301,10303,10313,10321,10331,10333,10337,10343,10357,10369,10391,10399,10427,10429,10433,10453,10457,10459,10463,10477,10487,10499,10501,10513,10529,10531,10559,10567,10589,10597,10601,10607,10613,10627,10631,10639,10651,10657,10663,10667,10687,10691,10709,10711,10723,10729,10733,10739,10753,10771,10781,10789,10799,10831,10837,10847,10853,10859,10861,10867,10883,10889,10891,10903,10909,10937,10939,10949,10957,10973,10979,10987,10993,11003,11027,11047,11057,11059,11069,11071,11083,11087,11093,11113,11117,11119,11131,11149,11159,11161,11171,11173,11177,11197,11213,11239,11243,11251,11257,11261,11273,11279,11287,11299,11311,11317,11321,11329,11351,11353,11369,11383,11393,11399,11411,11423,11437,11443,11447,11467,11471,11483,11489,11491,11497,11503,11519,11527,11549,11551,11579,11587,11593,11597,11617,11621,11633,11657,11677,11681,11689,11699,11701,11717,11719,11731,11743,11777,11779,11783,11789,11801,11807,11813,11821,11827,11831,11833,11839,11863,11867,11887,11897,11903,11909,11923,11927,11933,11939,11941,11953,11959,11969,11971,11981,11987,12007,12011,12037,12041,12043,12049,12071,12073,12097,12101,12107,12109,12113,12119,12143,12149,12157,12161,12163,12197,12203,12211,12227,12239,12241,12251,12253,12263,12269,12277,12281,12289,12301,12323,12329,12343,12347,12373,12377,12379,12391,12401,12409,12413,12421,12433,12437,12451,12457,12473,12479,12487,12491,12497,12503,12511,12517,12527,12539,12541,12547,12553,12569,12577,12583,12589,12601,12611,12613,12619,12637,12641,12647,12653,12659,12671,12689,12697,12703,12713,12721,12739,12743,12757,12763,12781,12791,12799,12809,12821,12823,12829,12841,12853,12889,12893,12899,12907,12911,12917,12919,12923,12941,12953,12959,12967,12973,12979,12983,13001,13003,13007,13009,13033,13037,13043,13049,13063,13093,13099,13103,13109,13121,13127,13147,13151,13159,13163,13171,13177,13183,13187,13217,13219,13229,13241,13249,13259,13267,13291,13297,13309,13313,13327,13331,13337,13339,13367,13381,13397,13399,13411,13417,13421,13441,13451,13457,13463,13469,13477,13487,13499,13513,13523,13537,13553,13567,13577,13591,13597,13613,13619,13627,13633,13649,13669,13679,13681,13687,13691,13693,13697,13709,13711,13721,13723,13729,13751,13757,13759,13763,13781,13789,13799,13807,13829,13831,13841,13859,13873,13877,13879,13883,13901,13903,13907,13913,13921,13931,13933,13963,13967,13997,13999,14009,14011,14029,14033,14051,14057,14071,14081,14083,14087,14107,14143,14149,14153,14159,14173,14177,14197,14207,14221,14243,14249,14251,14281,14293,14303,14321,14323,14327,14341,14347,14369,14387,14389,14401,14407,14411,14419,14423,14431,14437,14447,14449,14461,14479,14489,14503,14519,14533,14537,14543,14549,14551,14557,14561,14563,14591,14593,14621,14627,14629,14633,14639,14653,14657,14669,14683,14699,14713,14717,14723,14731,14737,14741,14747,14753,14759,14767,14771,14779,14783,14797,14813,14821,14827,14831,14843,14851,14867,14869,14879,14887,14891,14897,14923,14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073,15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187,15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289,15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391,15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527,15541,15551,15559,15569,15581,15583,15601,15607,15619,15629,15641,15643,15647,15649,15661,15667,15671,15679,15683,15727,15731,15733,15737,15739,15749,15761,15767,15773,15787,15791,15797,15803,15809,15817,15823,15859,15877,15881,15887,15889,15901,15907,15913,15919,15923,15937,15959,15971,15973,15991,16001,16007,16033,16057,16061,16063,16067,16069,16073,16087,16091,16097,16103,16111,16127,16139,16141,16183,16187,16189,16193,16217,16223,16229,16231,16249,16253,16267,16273,16301,16319,16333,16339,16349,16361,16363,16369,16381,16411,16417,16421,16427,16433,16447,16451,16453,16477,16481,16487,16493,16519,16529,16547,16553,16561,16567,16573,16603,16607,16619,16631,16633,16649,16651,16657,16661,16673,16691,16693,16699,16703,16729,16741,16747,16759,16763,16787,16811,16823,16829,16831,16843,16871,16879,16883,16889,16901,16903,16921,16927,16931,16937,16943,16963,16979,16981,16987,16993,17011,17021,17027,17029,17033,17041,17047,17053,17077,17093,17099,17107,17117,17123,17137,17159,17167,17183,17189,17191,17203,17207,17209,17231,17239,17257,17291,17293,17299,17317,17321,17327,17333,17341,17351,17359,17377,17383,17387,17389,17393,17401,17417,17419,17431,17443,17449,17467,17471,17477,17483,17489,17491,17497,17509,17519,17539,17551,17569,17573,17579,17581,17597,17599,17609,17623,17627,17657,17659,17669,17681,17683,17707,17713,17729,17737,17747,17749,17761,17783,17789,17791,17807,17827,17837,17839,17851,17863,17881,17891,17903,17909,17911,17921,17923,17929,17939,17957,17959,17971,17977,17981,17987,17989,18013,18041,18043,18047,18049,18059,18061,18077,18089,18097,18119,18121,18127,18131,18133,18143,18149,18169,18181,18191,18199,18211,18217,18223,18229,18233,18251,18253,18257,18269,18287,18289,18301,18307,18311,18313,18329,18341,18353,18367,18371,18379,18397,18401,18413,18427,18433,18439,18443,18451,18457,18461,18481,18493,18503,18517,18521,18523,18539,18541,18553,18583,18587,18593,18617,18637,18661,18671,18679,18691,18701,18713,18719,18731,18743,18749,18757,18773,18787,18793,18797,18803,18839,18859,18869,18899,18911,18913,18917,18919,18947,18959,18973,18979,19001,19009,19013,19031,19037,19051,19069,19073,19079,19081,19087,19121,19139,19141,19157,19163,19181,19183,19207,19211,19213,19219,19231,19237,19249,19259,19267,19273,19289,19301,19309,19319,19333,19373,19379,19381,19387,19391,19403,19417,19421,19423,19427,19429,19433,19441,19447,19457,19463,19469,19471,19477,19483,19489,19501,19507,19531,19541,19543,19553,19559,19571,19577,19583,19597,19603,19609,19661,19681,19687,19697,19699,19709,19717,19727,19739,19751,19753,19759,19763,19777,19793,19801,19813,19819,19841,19843,19853,19861,19867,19889,19891,19913,19919,19927,19937,19949,19961,19963,19973,19979,19991,19993,19997,20011,20021,20023,20029,20047,20051,20063,20071,20089,20101,20107,20113,20117,20123,20129,20143,20147,20149,20161,20173,20177,20183,20201,20219,20231,20233,20249,20261,20269,20287,20297,20323,20327,20333,20341,20347,20353,20357,20359,20369,20389,20393,20399,20407,20411,20431,20441,20443,20477,20479,20483,20507,20509,20521,20533,20543,20549,20551,20563,20593,20599,20611,20627,20639,20641,20663,20681,20693,20707,20717,20719,20731,20743,20747,20749,20753,20759,20771,20773,20789,20807,20809,20849,20857,20873,20879,20887,20897,20899,20903,20921,20929,20939,20947,20959,20963,20981,20983,21001,21011,21013,21017,21019,21023,21031,21059,21061,21067,21089,21101,21107,21121,21139,21143,21149,21157,21163,21169,21179,21187,21191,21193,21211,21221,21227,21247,21269,21277,21283,21313,21317,21319,21323,21341,21347,21377,21379,21383,21391,21397,21401,21407,21419,21433,21467,21481,21487,21491,21493,21499,21503,21517,21521,21523,21529,21557,21559,21563,21569,21577,21587,21589,21599,21601,21611,21613,21617,21647,21649,21661,21673,21683,21701,21713,21727,21737,21739,21751,21757,21767,21773,21787,21799,21803,21817,21821,21839,21841,21851,21859,21863,21871,21881,21893,21911,21929,21937,21943,21961,21977,21991,21997,22003,22013,22027,22031,22037,22039,22051,22063,22067,22073,22079,22091,22093,22109,22111,22123,22129,22133,22147,22153,22157,22159,22171,22189,22193,22229,22247,22259,22271,22273,22277,22279,22283,22291,22303,22307,22343,22349,22367,22369,22381,22391,22397,22409,22433,22441,22447,22453,22469,22481,22483,22501,22511,22531,22541,22543,22549,22567,22571,22573,22613,22619,22621,22637,22639,22643,22651,22669,22679,22691,22697,22699,22709,22717,22721,22727,22739,22741,22751,22769,22777,22783,22787,22807,22811,22817,22853,22859,22861,22871,22877,22901,22907,22921,22937,22943,22961,22963,22973,22993,23003,23011,23017,23021,23027,23029,23039,23041,23053,23057,23059,23063,23071,23081,23087,23099,23117,23131,23143,23159,23167,23173,23189,23197,23201,23203,23209,23227,23251,23269,23279,23291,23293,23297,23311,23321,23327,23333,23339,23357,23369,23371,23399,23417,23431,23447,23459,23473,23497,23509,23531,23537,23539,23549,23557,23561,23563,23567,23581,23593,23599,23603,23609,23623,23627,23629,23633,23663,23669,23671,23677,23687,23689,23719,23741,23743,23747,23753,23761,23767,23773,23789,23801,23813,23819,23827,23831,23833,23857,23869,23873,23879,23887,23893,23899,23909,23911,23917,23929,23957,23971,23977,23981,23993,24001,24007,24019,24023,24029,24043,24049,24061,24071,24077,24083,24091,24097,24103,24107,24109,24113,24121,24133,24137,24151,24169,24179,24181,24197,24203,24223,24229,24239,24247,24251,24281,24317,24329,24337,24359,24371,24373,24379,24391,24407,24413,24419,24421,24439,24443,24469,24473,24481,24499,24509,24517,24527,24533,24547,24551,24571,24593,24611,24623,24631,24659,24671,24677,24683,24691,24697,24709,24733,24749,24763,24767,24781,24793,24799,24809,24821,24841,24847,24851,24859,24877,24889,24907,24917,24919,24923,24943,24953,24967,24971,24977,24979,24989,25013,25031,25033,25037,25057,25073,25087,25097,25111,25117,25121,25127,25147,25153,25163,25169,25171,25183,25189,25219,25229,25237,25243,25247,25253,25261,25301,25303,25307,25309,25321,25339,25343,25349,25357,25367,25373,25391,25409,25411,25423,25439,25447,25453,25457,25463,25469,25471,25523,25537,25541,25561,25577,25579,25583,25589,25601,25603,25609,25621,25633,25639,25643,25657,25667,25673,25679,25693,25703,25717,25733,25741,25747,25759,25763,25771,25793,25799,25801,25819,25841,25847,25849,25867,25873,25889,25903,25913,25919,25931,25933,25939,25943,25951,25969,25981,25997,25999,26003,26017,26021,26029,26041,26053,26083,26099,26107,26111,26113,26119,26141,26153,26161,26171,26177,26183,26189,26203,26209,26227,26237,26249,26251,26261,26263,26267,26293,26297,26309,26317,26321,26339,26347,26357,26371,26387,26393,26399,26407,26417,26423,26431,26437,26449,26459,26479,26489,26497,26501,26513,26539,26557,26561,26573,26591,26597,26627,26633,26641,26647,26669,26681,26683,26687,26693,26699,26701,26711,26713,26717,26723,26729,26731,26737,26759,26777,26783,26801,26813,26821,26833,26839,26849,26861,26863,26879,26881,26891,26893,26903,26921,26927,26947,26951,26953,26959,26981,26987,26993,27011,27017,27031,27043,27059,27061,27067,27073,27077,27091,27103,27107,27109,27127,27143,27179,27191,27197,27211,27239,27241,27253,27259,27271,27277,27281,27283,27299,27329,27337,27361,27367,27397,27407,27409,27427,27431,27437,27449,27457,27479,27481,27487,27509,27527,27529,27539,27541,27551,27581,27583,27611,27617,27631,27647,27653,27673,27689,27691,27697,27701,27733,27737,27739,27743,27749,27751,27763,27767,27773,27779,27791,27793,27799,27803,27809,27817,27823,27827,27847,27851,27883,27893,27901,27917,27919,27941,27943,27947,27953,27961,27967,27983,27997,28001,28019,28027,28031,28051,28057,28069,28081,28087,28097,28099,28109,28111,28123,28151,28163,28181,28183,28201,28211,28219,28229,28277,28279,28283,28289,28297,28307,28309,28319,28349,28351,28387,28393,28403,28409,28411,28429,28433,28439,28447,28463,28477,28493,28499,28513,28517,28537,28541,28547,28549,28559,28571,28573,28579,28591,28597,28603,28607,28619,28621,28627,28631,28643,28649,28657,28661,28663,28669,28687,28697,28703,28711,28723,28729,28751,28753,28759,28771,28789,28793,28807,28813,28817,28837,28843,28859,28867,28871,28879,28901,28909,28921,28927,28933,28949,28961,28979,29009,29017,29021,29023,29027,29033,29059,29063,29077,29101,29123,29129,29131,29137,29147,29153,29167,29173,29179,29191,29201,29207,29209,29221,29231,29243,29251,29269,29287,29297,29303,29311,29327,29333,29339,29347,29363,29383,29387,29389,29399,29401,29411,29423,29429,29437,29443,29453,29473,29483,29501,29527,29531,29537,29567,29569,29573,29581,29587,29599,29611,29629,29633,29641,29663,29669,29671,29683,29717,29723,29741,29753,29759,29761,29789,29803,29819,29833,29837,29851,29863,29867,29873,29879,29881,29917,29921,29927,29947,29959,29983,29989,30011,30013,30029,30047,30059,30071,30089,30091,30097,30103,30109,30113,30119,30133,30137,30139,30161,30169,30181,30187,30197,30203,30211,30223,30241,30253,30259,30269,30271,30293,30307,30313,30319,30323,30341,30347,30367,30389,30391,30403,30427,30431,30449,30467,30469,30491,30493,30497,30509,30517,30529,30539,30553,30557,30559,30577,30593,30631,30637,30643,30649,30661,30671,30677,30689,30697,30703,30707,30713,30727,30757,30763,30773,30781,30803,30809,30817,30829,30839,30841,30851,30853,30859,30869,30871,30881,30893,30911,30931,30937,30941,30949,30971,30977,30983,31013,31019,31033,31039,31051,31063,31069,31079,31081,31091,31121,31123,31139,31147,31151,31153,31159,31177,31181,31183,31189,31193,31219,31223,31231,31237,31247,31249,31253,31259,31267,31271,31277,31307,31319,31321,31327,31333,31337,31357,31379,31387,31391,31393,31397,31469,31477,31481,31489,31511,31513,31517,31531,31541,31543,31547,31567,31573,31583,31601,31607,31627,31643,31649,31657,31663,31667,31687,31699,31721,31723,31727,31729,31741,31751,31769,31771,31793,31799,31817,31847,31849,31859,31873,31883,31891,31907,31957,31963,31973,31981,31991,32003,32009,32027,32029,32051,32057,32059,32063,32069,32077,32083,32089,32099,32117,32119,32141,32143,32159,32173,32183,32189,32191,32203,32213,32233,32237,32251,32257,32261,32297,32299,32303,32309,32321,32323,32327,32341,32353,32359,32363,32369,32371,32377,32381,32401,32411,32413,32423,32429,32441,32443,32467,32479,32491,32497,32503,32507,32531,32533,32537,32561,32563,32569,32573,32579,32587,32603,32609,32611,32621,32633,32647,32653,32687,32693,32707,32713,32717,32719,32749,TABMAX,TABMAX,TABMAX};
-const int * IntPrimeDom::TP = &(IntPrimeDom::IP)[2];
-
-int IntPrimeDom::isprime_Tabule(const int n)  const {
-       int plus = LOGMAX >> 1;
-       int here = plus;
-       int a;
-//        int loop = LOGMAX;
-//        while (loop) {
-       for(int loop = LOGMAX;loop; (loop >>= 1) ) {
-           if ( (a = (TP[here] - n)) == 0) return 1;
-           if (a > 0)
-               here -= (++plus >>= 1);
-            else
-               here += (++plus >>= 1);
-//            loop >>= 1;
-        }
-       return 0;
-}
-
-
-// JGD 08.06.2004
-// FULLY POMPED from GMP-4.1.3
-
-/*
-  We are to determine if c is a perfect power, c = a ^ b.
-  Assume c is divisible by 2^n and that codd = c/2^n is odd.
-  Assume a is divisible by 2^m and that aodd = a/2^m is odd.
-  It is always true that m divides n.
-
-  * If n is prime, either 1) a is 2*aodd and b = n
-		       or 2) a = c and b = 1.
-    So for n prime, we readily have a solution.
-  * If n is factorable into the non-trivial factors p1,p2,...
-    Since m divides n, m has a subset of n's factors and b = n / m.
-*/
-
-/* This is a naive approach to recognizing perfect powers.
-   Many things can be improved.  In particular, we should use p-adic
-   arithmetic for computing possible roots.  */
-
-static const unsigned short primes[] =
-{  2,  3,  5,  7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
-  59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113,127,131,
- 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
- 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,
- 313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
- 419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,
- 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,
- 617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,
- 727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,
- 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,
- 947,953,967,971,977,983,991,997,0
-};
+
+	// =================================================================== //
+	// Primality tests
+	// =================================================================== //
+	IntPrimeDom::Rep& IntPrimeDom::nextprimein(Rep& n, int r)  const
+	{
+		if (isleq( n,1)) return n=2;
+		Rep tmp;
+		mod( tmp, n, 2UL);
+		if ( isZero(tmp) )
+			addin(n,1);
+		else
+			addin(n,2);
+		while (! isprime(n,r) )
+			addin(n,2);
+		return n;
+	}
+
+	IntPrimeDom::Rep& IntPrimeDom::nextprime(Rep& n, const Rep& p, int r)  const
+	{
+		if (isleq( p,1)) return n=2;
+		if (&n == &p) return nextprimein(n,r);
+		if (isZero( mod(n,p,2)))
+			add(n,p,1);
+		else
+			add(n,p,2);
+		while (! isprime(n,r) )
+			addin(n,2);
+
+		return n;
+	}
+
+	IntPrimeDom::Rep& IntPrimeDom::prevprimein(Rep& n, int r)  const
+	{
+		if (isleq( n,2)) return n=2;
+		Rep tmp;
+		mod(tmp, n, 2UL);
+		if (isZero(tmp) )
+			subin(n,1);
+		else
+			subin(n,2);
+		while (! isprime(n,r) )
+			subin(n,2);
+		return n;
+	}
+
+	IntPrimeDom::Rep& IntPrimeDom::prevprime(Rep& n, const Rep& p, int r)  const
+	{
+		if (isleq( p,2)) return n=2;
+		if (&n == &p) return prevprimein(n,r);
+		if (isZero( mod(n,p,2)) )
+			sub(n,p,1);
+		else
+			sub(n,p,2);
+		while (! isprime(n,r) )
+			subin(n,2);
+		return n;
+	}
+
+
+
+	int IntPrimeDom::IP2[LOGMAX2+5] =
+	{-1,-1,32749,32771,32779,32783,32789,32797,32801,32803,32831,32833,32839,32843,32869,32887,32909,32911,32917,32933,32939,32941,32957,32969,32971,32983,32987,32993,32999,33013,33023,33029,33037,33049,33053,33071,33073,33083,33091,33107,33113,33119,33149,33151,33161,33179,33181,33191,33199,33203,33211,33223,33247,33287,33289,33301,33311,33317,33329,33331,33343,33347,33349,33353,33359,33377,33391,33403,33409,33413,33427,33457,33461,33469,33479,33487,33493,33503,33521,33529,33533,33547,33563,33569,33577,33581,33587,33589,33599,33601,33613,33617,33619,33623,33629,33637,33641,33647,33679,33703,33713,33721,33739,33749,33751,33757,33767,33769,33773,33791,33797,33809,33811,33827,33829,33851,33857,33863,33871,33889,33893,33911,33923,33931,33937,33941,33961,33967,33997,34019,34031,34033,34039,34057,34061,34123,34127,34129,34141,34147,34157,34159,34171,34183,34211,34213,34217,34231,34253,34259,34261,34267,34273,34283,34297,34301,34303,34313,34319,34327,34337,34351,34361,34367,34369,34381,34403,34421,34429,34439,34457,34469,34471,34483,34487,34499,34501,34511,34513,34519,34537,34543,34549,34583,34589,34591,34603,34607,34613,34631,34649,34651,34667,34673,34679,34687,34693,34703,34721,34729,34739,34747,34757,34759,34763,34781,34807,34819,34841,34843,34847,34849,34871,34877,34883,34897,34913,34919,34939,34949,34961,34963,34981,35023,35027,35051,35053,35059,35069,35081,35083,35089,35099,35107,35111,35117,35129,35141,35149,35153,35159,35171,35201,35221,35227,35251,35257,35267,35279,35281,35291,35311,35317,35323,35327,35339,35353,35363,35381,35393,35401,35407,35419,35423,35437,35447,35449,35461,35491,35507,35509,35521,35527,35531,35533,35537,35543,35569,35573,35591,35593,35597,35603,35617,35671,35677,35729,35731,35747,35753,35759,35771,35797,35801,35803,35809,35831,35837,35839,35851,35863,35869,35879,35897,35899,35911,35923,35933,35951,35963,35969,35977,35983,35993,35999,36007,36011,36013,36017,36037,36061,36067,36073,36083,36097,36107,36109,36131,36137,36151,36161,36187,36191,36209,36217,36229,36241,36251,36263,36269,36277,36293,36299,36307,36313,36319,36341,36343,36353,36373,36383,36389,36433,36451,36457,36467,36469,36473,36479,36493,36497,36523,36527,36529,36541,36551,36559,36563,36571,36583,36587,36599,36607,36629,36637,36643,36653,36671,36677,36683,36691,36697,36709,36713,36721,36739,36749,36761,36767,36779,36781,36787,36791,36793,36809,36821,36833,36847,36857,36871,36877,36887,36899,36901,36913,36919,36923,36929,36931,36943,36947,36973,36979,36997,37003,37013,37019,37021,37039,37049,37057,37061,37087,37097,37117,37123,37139,37159,37171,37181,37189,37199,37201,37217,37223,37243,37253,37273,37277,37307,37309,37313,37321,37337,37339,37357,37361,37363,37369,37379,37397,37409,37423,37441,37447,37463,37483,37489,37493,37501,37507,37511,37517,37529,37537,37547,37549,37561,37567,37571,37573,37579,37589,37591,37607,37619,37633,37643,37649,37657,37663,37691,37693,37699,37717,37747,37781,37783,37799,37811,37813,37831,37847,37853,37861,37871,37879,37889,37897,37907,37951,37957,37963,37967,37987,37991,37993,37997,38011,38039,38047,38053,38069,38083,38113,38119,38149,38153,38167,38177,38183,38189,38197,38201,38219,38231,38237,38239,38261,38273,38281,38287,38299,38303,38317,38321,38327,38329,38333,38351,38371,38377,38393,38431,38447,38449,38453,38459,38461,38501,38543,38557,38561,38567,38569,38593,38603,38609,38611,38629,38639,38651,38653,38669,38671,38677,38693,38699,38707,38711,38713,38723,38729,38737,38747,38749,38767,38783,38791,38803,38821,38833,38839,38851,38861,38867,38873,38891,38903,38917,38921,38923,38933,38953,38959,38971,38977,38993,39019,39023,39041,39043,39047,39079,39089,39097,39103,39107,39113,39119,39133,39139,39157,39161,39163,39181,39191,39199,39209,39217,39227,39229,39233,39239,39241,39251,39293,39301,39313,39317,39323,39341,39343,39359,39367,39371,39373,39383,39397,39409,39419,39439,39443,39451,39461,39499,39503,39509,39511,39521,39541,39551,39563,39569,39581,39607,39619,39623,39631,39659,39667,39671,39679,39703,39709,39719,39727,39733,39749,39761,39769,39779,39791,39799,39821,39827,39829,39839,39841,39847,39857,39863,39869,39877,39883,39887,39901,39929,39937,39953,39971,39979,39983,39989,40009,40013,40031,40037,40039,40063,40087,40093,40099,40111,40123,40127,40129,40151,40153,40163,40169,40177,40189,40193,40213,40231,40237,40241,40253,40277,40283,40289,40343,40351,40357,40361,40387,40423,40427,40429,40433,40459,40471,40483,40487,40493,40499,40507,40519,40529,40531,40543,40559,40577,40583,40591,40597,40609,40627,40637,40639,40693,40697,40699,40709,40739,40751,40759,40763,40771,40787,40801,40813,40819,40823,40829,40841,40847,40849,40853,40867,40879,40883,40897,40903,40927,40933,40939,40949,40961,40973,40993,41011,41017,41023,41039,41047,41051,41057,41077,41081,41113,41117,41131,41141,41143,41149,41161,41177,41179,41183,41189,41201,41203,41213,41221,41227,41231,41233,41243,41257,41263,41269,41281,41299,41333,41341,41351,41357,41381,41387,41389,41399,41411,41413,41443,41453,41467,41479,41491,41507,41513,41519,41521,41539,41543,41549,41579,41593,41597,41603,41609,41611,41617,41621,41627,41641,41647,41651,41659,41669,41681,41687,41719,41729,41737,41759,41761,41771,41777,41801,41809,41813,41843,41849,41851,41863,41879,41887,41893,41897,41903,41911,41927,41941,41947,41953,41957,41959,41969,41981,41983,41999,42013,42017,42019,42023,42043,42061,42071,42073,42083,42089,42101,42131,42139,42157,42169,42179,42181,42187,42193,42197,42209,42221,42223,42227,42239,42257,42281,42283,42293,42299,42307,42323,42331,42337,42349,42359,42373,42379,42391,42397,42403,42407,42409,42433,42437,42443,42451,42457,42461,42463,42467,42473,42487,42491,42499,42509,42533,42557,42569,42571,42577,42589,42611,42641,42643,42649,42667,42677,42683,42689,42697,42701,42703,42709,42719,42727,42737,42743,42751,42767,42773,42787,42793,42797,42821,42829,42839,42841,42853,42859,42863,42899,42901,42923,42929,42937,42943,42953,42961,42967,42979,42989,43003,43013,43019,43037,43049,43051,43063,43067,43093,43103,43117,43133,43151,43159,43177,43189,43201,43207,43223,43237,43261,43271,43283,43291,43313,43319,43321,43331,43391,43397,43399,43403,43411,43427,43441,43451,43457,43481,43487,43499,43517,43541,43543,43573,43577,43579,43591,43597,43607,43609,43613,43627,43633,43649,43651,43661,43669,43691,43711,43717,43721,43753,43759,43777,43781,43783,43787,43789,43793,43801,43853,43867,43889,43891,43913,43933,43943,43951,43961,43963,43969,43973,43987,43991,43997,44017,44021,44027,44029,44041,44053,44059,44071,44087,44089,44101,44111,44119,44123,44129,44131,44159,44171,44179,44189,44201,44203,44207,44221,44249,44257,44263,44267,44269,44273,44279,44281,44293,44351,44357,44371,44381,44383,44389,44417,44449,44453,44483,44491,44497,44501,44507,44519,44531,44533,44537,44543,44549,44563,44579,44587,44617,44621,44623,44633,44641,44647,44651,44657,44683,44687,44699,44701,44711,44729,44741,44753,44771,44773,44777,44789,44797,44809,44819,44839,44843,44851,44867,44879,44887,44893,44909,44917,44927,44939,44953,44959,44963,44971,44983,44987,45007,45013,45053,45061,45077,45083,45119,45121,45127,45131,45137,45139,45161,45179,45181,45191,45197,45233,45247,45259,45263,45281,45289,45293,45307,45317,45319,45329,45337,45341,45343,45361,45377,45389,45403,45413,45427,45433,45439,45481,45491,45497,45503,45523,45533,45541,45553,45557,45569,45587,45589,45599,45613,45631,45641,45659,45667,45673,45677,45691,45697,45707,45737,45751,45757,45763,45767,45779,45817,45821,45823,45827,45833,45841,45853,45863,45869,45887,45893,45943,45949,45953,45959,45971,45979,45989,46021,46027,46049,46051,46061,46073,46091,46093,46099,46103,46133,46141,46147,46153,46171,46181,46183,46187,46199,46219,46229,46237,46261,46271,46273,46279,46301,46307,46309,46327,46337,46349,46351,46381,46399,46411,46439,46441,46447,46451,46457,46471,46477,46489,46499,46507,46511,46523,46549,46559,46567,46573,46589,46591,46601,46619,46633,46639,46643,46649,46663,46679,46681,46687,46691,46703,46723,46727,46747,46751,46757,46769,46771,46807,46811,46817,46819,46829,46831,46853,46861,46867,46877,46889,46901,46919,46933,46957,46993,46997,47017,47041,47051,47057,47059,47087,47093,47111,47119,47123,47129,47137,47143,47147,47149,47161,47189,47207,47221,47237,47251,47269,47279,47287,47293,47297,47303,47309,47317,47339,47351,47353,47363,47381,47387,47389,47407,47417,47419,47431,47441,47459,47491,47497,47501,47507,47513,47521,47527,47533,47543,47563,47569,47581,47591,47599,47609,47623,47629,47639,47653,47657,47659,47681,47699,47701,47711,47713,47717,47737,47741,47743,47777,47779,47791,47797,47807,47809,47819,47837,47843,47857,47869,47881,47903,47911,47917,47933,47939,47947,47951,47963,47969,47977,47981,48017,48023,48029,48049,48073,48079,48091,48109,48119,48121,48131,48157,48163,48179,48187,48193,48197,48221,48239,48247,48259,48271,48281,48299,48311,48313,48337,48341,48353,48371,48383,48397,48407,48409,48413,48437,48449,48463,48473,48479,48481,48487,48491,48497,48523,48527,48533,48539,48541,48563,48571,48589,48593,48611,48619,48623,48647,48649,48661,48673,48677,48679,48731,48733,48751,48757,48761,48767,48779,48781,48787,48799,48809,48817,48821,48823,48847,48857,48859,48869,48871,48883,48889,48907,48947,48953,48973,48989,48991,49003,49009,49019,49031,49033,49037,49043,49057,49069,49081,49103,49109,49117,49121,49123,49139,49157,49169,49171,49177,49193,49199,49201,49207,49211,49223,49253,49261,49277,49279,49297,49307,49331,49333,49339,49363,49367,49369,49391,49393,49409,49411,49417,49429,49433,49451,49459,49463,49477,49481,49499,49523,49529,49531,49537,49547,49549,49559,49597,49603,49613,49627,49633,49639,49663,49667,49669,49681,49697,49711,49727,49739,49741,49747,49757,49783,49787,49789,49801,49807,49811,49823,49831,49843,49853,49871,49877,49891,49919,49921,49927,49937,49939,49943,49957,49991,49993,49999,50021,50023,50033,50047,50051,50053,50069,50077,50087,50093,50101,50111,50119,50123,50129,50131,50147,50153,50159,50177,50207,50221,50227,50231,50261,50263,50273,50287,50291,50311,50321,50329,50333,50341,50359,50363,50377,50383,50387,50411,50417,50423,50441,50459,50461,50497,50503,50513,50527,50539,50543,50549,50551,50581,50587,50591,50593,50599,50627,50647,50651,50671,50683,50707,50723,50741,50753,50767,50773,50777,50789,50821,50833,50839,50849,50857,50867,50873,50891,50893,50909,50923,50929,50951,50957,50969,50971,50989,50993,51001,51031,51043,51047,51059,51061,51071,51109,51131,51133,51137,51151,51157,51169,51193,51197,51199,51203,51217,51229,51239,51241,51257,51263,51283,51287,51307,51329,51341,51343,51347,51349,51361,51383,51407,51413,51419,51421,51427,51431,51437,51439,51449,51461,51473,51479,51481,51487,51503,51511,51517,51521,51539,51551,51563,51577,51581,51593,51599,51607,51613,51631,51637,51647,51659,51673,51679,51683,51691,51713,51719,51721,51749,51767,51769,51787,51797,51803,51817,51827,51829,51839,51853,51859,51869,51871,51893,51899,51907,51913,51929,51941,51949,51971,51973,51977,51991,52009,52021,52027,52051,52057,52067,52069,52081,52103,52121,52127,52147,52153,52163,52177,52181,52183,52189,52201,52223,52237,52249,52253,52259,52267,52289,52291,52301,52313,52321,52361,52363,52369,52379,52387,52391,52433,52453,52457,52489,52501,52511,52517,52529,52541,52543,52553,52561,52567,52571,52579,52583,52609,52627,52631,52639,52667,52673,52691,52697,52709,52711,52721,52727,52733,52747,52757,52769,52783,52807,52813,52817,52837,52859,52861,52879,52883,52889,52901,52903,52919,52937,52951,52957,52963,52967,52973,52981,52999,53003,53017,53047,53051,53069,53077,53087,53089,53093,53101,53113,53117,53129,53147,53149,53161,53171,53173,53189,53197,53201,53231,53233,53239,53267,53269,53279,53281,53299,53309,53323,53327,53353,53359,53377,53381,53401,53407,53411,53419,53437,53441,53453,53479,53503,53507,53527,53549,53551,53569,53591,53593,53597,53609,53611,53617,53623,53629,53633,53639,53653,53657,53681,53693,53699,53717,53719,53731,53759,53773,53777,53783,53791,53813,53819,53831,53849,53857,53861,53881,53887,53891,53897,53899,53917,53923,53927,53939,53951,53959,53987,53993,54001,54011,54013,54037,54049,54059,54083,54091,54101,54121,54133,54139,54151,54163,54167,54181,54193,54217,54251,54269,54277,54287,54293,54311,54319,54323,54331,54347,54361,54367,54371,54377,54401,54403,54409,54413,54419,54421,54437,54443,54449,54469,54493,54497,54499,54503,54517,54521,54539,54541,54547,54559,54563,54577,54581,54583,54601,54617,54623,54629,54631,54647,54667,54673,54679,54709,54713,54721,54727,54751,54767,54773,54779,54787,54799,54829,54833,54851,54869,54877,54881,54907,54917,54919,54941,54949,54959,54973,54979,54983,55001,55009,55021,55049,55051,55057,55061,55073,55079,55103,55109,55117,55127,55147,55163,55171,55201,55207,55213,55217,55219,55229,55243,55249,55259,55291,55313,55331,55333,55337,55339,55343,55351,55373,55381,55399,55411,55439,55441,55457,55469,55487,55501,55511,55529,55541,55547,55579,55589,55603,55609,55619,55621,55631,55633,55639,55661,55663,55667,55673,55681,55691,55697,55711,55717,55721,55733,55763,55787,55793,55799,55807,55813,55817,55819,55823,55829,55837,55843,55849,55871,55889,55897,55901,55903,55921,55927,55931,55933,55949,55967,55987,55997,56003,56009,56039,56041,56053,56081,56087,56093,56099,56101,56113,56123,56131,56149,56167,56171,56179,56197,56207,56209,56237,56239,56249,56263,56267,56269,56299,56311,56333,56359,56369,56377,56383,56393,56401,56417,56431,56437,56443,56453,56467,56473,56477,56479,56489,56501,56503,56509,56519,56527,56531,56533,56543,56569,56591,56597,56599,56611,56629,56633,56659,56663,56671,56681,56687,56701,56711,56713,56731,56737,56747,56767,56773,56779,56783,56807,56809,56813,56821,56827,56843,56857,56873,56891,56893,56897,56909,56911,56921,56923,56929,56941,56951,56957,56963,56983,56989,56993,56999,57037,57041,57047,57059,57073,57077,57089,57097,57107,57119,57131,57139,57143,57149,57163,57173,57179,57191,57193,57203,57221,57223,57241,57251,57259,57269,57271,57283,57287,57301,57329,57331,57347,57349,57367,57373,57383,57389,57397,57413,57427,57457,57467,57487,57493,57503,57527,57529,57557,57559,57571,57587,57593,57601,57637,57641,57649,57653,57667,57679,57689,57697,57709,57713,57719,57727,57731,57737,57751,57773,57781,57787,57791,57793,57803,57809,57829,57839,57847,57853,57859,57881,57899,57901,57917,57923,57943,57947,57973,57977,57991,58013,58027,58031,58043,58049,58057,58061,58067,58073,58099,58109,58111,58129,58147,58151,58153,58169,58171,58189,58193,58199,58207,58211,58217,58229,58231,58237,58243,58271,58309,58313,58321,58337,58363,58367,58369,58379,58391,58393,58403,58411,58417,58427,58439,58441,58451,58453,58477,58481,58511,58537,58543,58549,58567,58573,58579,58601,58603,58613,58631,58657,58661,58679,58687,58693,58699,58711,58727,58733,58741,58757,58763,58771,58787,58789,58831,58889,58897,58901,58907,58909,58913,58921,58937,58943,58963,58967,58979,58991,58997,59009,59011,59021,59023,59029,59051,59053,59063,59069,59077,59083,59093,59107,59113,59119,59123,59141,59149,59159,59167,59183,59197,59207,59209,59219,59221,59233,59239,59243,59263,59273,59281,59333,59341,59351,59357,59359,59369,59377,59387,59393,59399,59407,59417,59419,59441,59443,59447,59453,59467,59471,59473,59497,59509,59513,59539,59557,59561,59567,59581,59611,59617,59621,59627,59629,59651,59659,59663,59669,59671,59693,59699,59707,59723,59729,59743,59747,59753,59771,59779,59791,59797,59809,59833,59863,59879,59887,59921,59929,59951,59957,59971,59981,59999,60013,60017,60029,60037,60041,60077,60083,60089,60091,60101,60103,60107,60127,60133,60139,60149,60161,60167,60169,60209,60217,60223,60251,60257,60259,60271,60289,60293,60317,60331,60337,60343,60353,60373,60383,60397,60413,60427,60443,60449,60457,60493,60497,60509,60521,60527,60539,60589,60601,60607,60611,60617,60623,60631,60637,60647,60649,60659,60661,60679,60689,60703,60719,60727,60733,60737,60757,60761,60763,60773,60779,60793,60811,60821,60859,60869,60887,60889,60899,60901,60913,60917,60919,60923,60937,60943,60953,60961,61001,61007,61027,61031,61043,61051,61057,61091,61099,61121,61129,61141,61151,61153,61169,61211,61223,61231,61253,61261,61283,61291,61297,61331,61333,61339,61343,61357,61363,61379,61381,61403,61409,61417,61441,61463,61469,61471,61483,61487,61493,61507,61511,61519,61543,61547,61553,61559,61561,61583,61603,61609,61613,61627,61631,61637,61643,61651,61657,61667,61673,61681,61687,61703,61717,61723,61729,61751,61757,61781,61813,61819,61837,61843,61861,61871,61879,61909,61927,61933,61949,61961,61967,61979,61981,61987,61991,62003,62011,62017,62039,62047,62053,62057,62071,62081,62099,62119,62129,62131,62137,62141,62143,62171,62189,62191,62201,62207,62213,62219,62233,62273,62297,62299,62303,62311,62323,62327,62347,62351,62383,62401,62417,62423,62459,62467,62473,62477,62483,62497,62501,62507,62533,62539,62549,62563,62581,62591,62597,62603,62617,62627,62633,62639,62653,62659,62683,62687,62701,62723,62731,62743,62753,62761,62773,62791,62801,62819,62827,62851,62861,62869,62873,62897,62903,62921,62927,62929,62939,62969,62971,62981,62983,62987,62989,63029,63031,63059,63067,63073,63079,63097,63103,63113,63127,63131,63149,63179,63197,63199,63211,63241,63247,63277,63281,63299,63311,63313,63317,63331,63337,63347,63353,63361,63367,63377,63389,63391,63397,63409,63419,63421,63439,63443,63463,63467,63473,63487,63493,63499,63521,63527,63533,63541,63559,63577,63587,63589,63599,63601,63607,63611,63617,63629,63647,63649,63659,63667,63671,63689,63691,63697,63703,63709,63719,63727,63737,63743,63761,63773,63781,63793,63799,63803,63809,63823,63839,63841,63853,63857,63863,63901,63907,63913,63929,63949,63977,63997,64007,64013,64019,64033,64037,64063,64067,64081,64091,64109,64123,64151,64153,64157,64171,64187,64189,64217,64223,64231,64237,64271,64279,64283,64301,64303,64319,64327,64333,64373,64381,64399,64403,64433,64439,64451,64453,64483,64489,64499,64513,64553,64567,64577,64579,64591,64601,64609,64613,64621,64627,64633,64661,64663,64667,64679,64693,64709,64717,64747,64763,64781,64783,64793,64811,64817,64849,64853,64871,64877,64879,64891,64901,64919,64921,64927,64937,64951,64969,64997,65003,65011,65027,65029,65033,65053,65063,65071,65089,65099,65101,65111,65119,65123,65129,65141,65147,65167,65171,65173,65179,65183,65203,65213,65239,65257,65267,65269,65287,65293,65309,65323,65327,65353,65357,65371,65381,65393,65407,65413,65419,65423,65437,65447,65449,65479,65497,65519,65521,TABMAX2,TABMAX2,TABMAX2};
+
+	const int * IntPrimeDom::TP2 = &(IntPrimeDom::IP2)[2];
+
+	int IntPrimeDom::isprime_Tabule2(const int n)  const
+	{
+		int plus = LOGMAX2 >> 1;
+		int here = plus;
+		int a;
+		//        int loop = LOGMAX2;
+		//        while (loop)
+		for(int loop = LOGMAX2;loop; (loop >>= 1) ) {
+			if ( (a = (TP2[here] - n)) == 0) return 1;
+			if (a > 0)
+				here -= (++plus >>= 1);
+			else
+				here += (++plus >>= 1);
+			//            loop >>= 1;
+		}
+		return 0;
+	}
+
+
+	int IntPrimeDom::IP[LOGMAX+5] =
+	{-1,-1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973,10007,10009,10037,10039,10061,10067,10069,10079,10091,10093,10099,10103,10111,10133,10139,10141,10151,10159,10163,10169,10177,10181,10193,10211,10223,10243,10247,10253,10259,10267,10271,10273,10289,10301,10303,10313,10321,10331,10333,10337,10343,10357,10369,10391,10399,10427,10429,10433,10453,10457,10459,10463,10477,10487,10499,10501,10513,10529,10531,10559,10567,10589,10597,10601,10607,10613,10627,10631,10639,10651,10657,10663,10667,10687,10691,10709,10711,10723,10729,10733,10739,10753,10771,10781,10789,10799,10831,10837,10847,10853,10859,10861,10867,10883,10889,10891,10903,10909,10937,10939,10949,10957,10973,10979,10987,10993,11003,11027,11047,11057,11059,11069,11071,11083,11087,11093,11113,11117,11119,11131,11149,11159,11161,11171,11173,11177,11197,11213,11239,11243,11251,11257,11261,11273,11279,11287,11299,11311,11317,11321,11329,11351,11353,11369,11383,11393,11399,11411,11423,11437,11443,11447,11467,11471,11483,11489,11491,11497,11503,11519,11527,11549,11551,11579,11587,11593,11597,11617,11621,11633,11657,11677,11681,11689,11699,11701,11717,11719,11731,11743,11777,11779,11783,11789,11801,11807,11813,11821,11827,11831,11833,11839,11863,11867,11887,11897,11903,11909,11923,11927,11933,11939,11941,11953,11959,11969,11971,11981,11987,12007,12011,12037,12041,12043,12049,12071,12073,12097,12101,12107,12109,12113,12119,12143,12149,12157,12161,12163,12197,12203,12211,12227,12239,12241,12251,12253,12263,12269,12277,12281,12289,12301,12323,12329,12343,12347,12373,12377,12379,12391,12401,12409,12413,12421,12433,12437,12451,12457,12473,12479,12487,12491,12497,12503,12511,12517,12527,12539,12541,12547,12553,12569,12577,12583,12589,12601,12611,12613,12619,12637,12641,12647,12653,12659,12671,12689,12697,12703,12713,12721,12739,12743,12757,12763,12781,12791,12799,12809,12821,12823,12829,12841,12853,12889,12893,12899,12907,12911,12917,12919,12923,12941,12953,12959,12967,12973,12979,12983,13001,13003,13007,13009,13033,13037,13043,13049,13063,13093,13099,13103,13109,13121,13127,13147,13151,13159,13163,13171,13177,13183,13187,13217,13219,13229,13241,13249,13259,13267,13291,13297,13309,13313,13327,13331,13337,13339,13367,13381,13397,13399,13411,13417,13421,13441,13451,13457,13463,13469,13477,13487,13499,13513,13523,13537,13553,13567,13577,13591,13597,13613,13619,13627,13633,13649,13669,13679,13681,13687,13691,13693,13697,13709,13711,13721,13723,13729,13751,13757,13759,13763,13781,13789,13799,13807,13829,13831,13841,13859,13873,13877,13879,13883,13901,13903,13907,13913,13921,13931,13933,13963,13967,13997,13999,14009,14011,14029,14033,14051,14057,14071,14081,14083,14087,14107,14143,14149,14153,14159,14173,14177,14197,14207,14221,14243,14249,14251,14281,14293,14303,14321,14323,14327,14341,14347,14369,14387,14389,14401,14407,14411,14419,14423,14431,14437,14447,14449,14461,14479,14489,14503,14519,14533,14537,14543,14549,14551,14557,14561,14563,14591,14593,14621,14627,14629,14633,14639,14653,14657,14669,14683,14699,14713,14717,14723,14731,14737,14741,14747,14753,14759,14767,14771,14779,14783,14797,14813,14821,14827,14831,14843,14851,14867,14869,14879,14887,14891,14897,14923,14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073,15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187,15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289,15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391,15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527,15541,15551,15559,15569,15581,15583,15601,15607,15619,15629,15641,15643,15647,15649,15661,15667,15671,15679,15683,15727,15731,15733,15737,15739,15749,15761,15767,15773,15787,15791,15797,15803,15809,15817,15823,15859,15877,15881,15887,15889,15901,15907,15913,15919,15923,15937,15959,15971,15973,15991,16001,16007,16033,16057,16061,16063,16067,16069,16073,16087,16091,16097,16103,16111,16127,16139,16141,16183,16187,16189,16193,16217,16223,16229,16231,16249,16253,16267,16273,16301,16319,16333,16339,16349,16361,16363,16369,16381,16411,16417,16421,16427,16433,16447,16451,16453,16477,16481,16487,16493,16519,16529,16547,16553,16561,16567,16573,16603,16607,16619,16631,16633,16649,16651,16657,16661,16673,16691,16693,16699,16703,16729,16741,16747,16759,16763,16787,16811,16823,16829,16831,16843,16871,16879,16883,16889,16901,16903,16921,16927,16931,16937,16943,16963,16979,16981,16987,16993,17011,17021,17027,17029,17033,17041,17047,17053,17077,17093,17099,17107,17117,17123,17137,17159,17167,17183,17189,17191,17203,17207,17209,17231,17239,17257,17291,17293,17299,17317,17321,17327,17333,17341,17351,17359,17377,17383,17387,17389,17393,17401,17417,17419,17431,17443,17449,17467,17471,17477,17483,17489,17491,17497,17509,17519,17539,17551,17569,17573,17579,17581,17597,17599,17609,17623,17627,17657,17659,17669,17681,17683,17707,17713,17729,17737,17747,17749,17761,17783,17789,17791,17807,17827,17837,17839,17851,17863,17881,17891,17903,17909,17911,17921,17923,17929,17939,17957,17959,17971,17977,17981,17987,17989,18013,18041,18043,18047,18049,18059,18061,18077,18089,18097,18119,18121,18127,18131,18133,18143,18149,18169,18181,18191,18199,18211,18217,18223,18229,18233,18251,18253,18257,18269,18287,18289,18301,18307,18311,18313,18329,18341,18353,18367,18371,18379,18397,18401,18413,18427,18433,18439,18443,18451,18457,18461,18481,18493,18503,18517,18521,18523,18539,18541,18553,18583,18587,18593,18617,18637,18661,18671,18679,18691,18701,18713,18719,18731,18743,18749,18757,18773,18787,18793,18797,18803,18839,18859,18869,18899,18911,18913,18917,18919,18947,18959,18973,18979,19001,19009,19013,19031,19037,19051,19069,19073,19079,19081,19087,19121,19139,19141,19157,19163,19181,19183,19207,19211,19213,19219,19231,19237,19249,19259,19267,19273,19289,19301,19309,19319,19333,19373,19379,19381,19387,19391,19403,19417,19421,19423,19427,19429,19433,19441,19447,19457,19463,19469,19471,19477,19483,19489,19501,19507,19531,19541,19543,19553,19559,19571,19577,19583,19597,19603,19609,19661,19681,19687,19697,19699,19709,19717,19727,19739,19751,19753,19759,19763,19777,19793,19801,19813,19819,19841,19843,19853,19861,19867,19889,19891,19913,19919,19927,19937,19949,19961,19963,19973,19979,19991,19993,19997,20011,20021,20023,20029,20047,20051,20063,20071,20089,20101,20107,20113,20117,20123,20129,20143,20147,20149,20161,20173,20177,20183,20201,20219,20231,20233,20249,20261,20269,20287,20297,20323,20327,20333,20341,20347,20353,20357,20359,20369,20389,20393,20399,20407,20411,20431,20441,20443,20477,20479,20483,20507,20509,20521,20533,20543,20549,20551,20563,20593,20599,20611,20627,20639,20641,20663,20681,20693,20707,20717,20719,20731,20743,20747,20749,20753,20759,20771,20773,20789,20807,20809,20849,20857,20873,20879,20887,20897,20899,20903,20921,20929,20939,20947,20959,20963,20981,20983,21001,21011,21013,21017,21019,21023,21031,21059,21061,21067,21089,21101,21107,21121,21139,21143,21149,21157,21163,21169,21179,21187,21191,21193,21211,21221,21227,21247,21269,21277,21283,21313,21317,21319,21323,21341,21347,21377,21379,21383,21391,21397,21401,21407,21419,21433,21467,21481,21487,21491,21493,21499,21503,21517,21521,21523,21529,21557,21559,21563,21569,21577,21587,21589,21599,21601,21611,21613,21617,21647,21649,21661,21673,21683,21701,21713,21727,21737,21739,21751,21757,21767,21773,21787,21799,21803,21817,21821,21839,21841,21851,21859,21863,21871,21881,21893,21911,21929,21937,21943,21961,21977,21991,21997,22003,22013,22027,22031,22037,22039,22051,22063,22067,22073,22079,22091,22093,22109,22111,22123,22129,22133,22147,22153,22157,22159,22171,22189,22193,22229,22247,22259,22271,22273,22277,22279,22283,22291,22303,22307,22343,22349,22367,22369,22381,22391,22397,22409,22433,22441,22447,22453,22469,22481,22483,22501,22511,22531,22541,22543,22549,22567,22571,22573,22613,22619,22621,22637,22639,22643,22651,22669,22679,22691,22697,22699,22709,22717,22721,22727,22739,22741,22751,22769,22777,22783,22787,22807,22811,22817,22853,22859,22861,22871,22877,22901,22907,22921,22937,22943,22961,22963,22973,22993,23003,23011,23017,23021,23027,23029,23039,23041,23053,23057,23059,23063,23071,23081,23087,23099,23117,23131,23143,23159,23167,23173,23189,23197,23201,23203,23209,23227,23251,23269,23279,23291,23293,23297,23311,23321,23327,23333,23339,23357,23369,23371,23399,23417,23431,23447,23459,23473,23497,23509,23531,23537,23539,23549,23557,23561,23563,23567,23581,23593,23599,23603,23609,23623,23627,23629,23633,23663,23669,23671,23677,23687,23689,23719,23741,23743,23747,23753,23761,23767,23773,23789,23801,23813,23819,23827,23831,23833,23857,23869,23873,23879,23887,23893,23899,23909,23911,23917,23929,23957,23971,23977,23981,23993,24001,24007,24019,24023,24029,24043,24049,24061,24071,24077,24083,24091,24097,24103,24107,24109,24113,24121,24133,24137,24151,24169,24179,24181,24197,24203,24223,24229,24239,24247,24251,24281,24317,24329,24337,24359,24371,24373,24379,24391,24407,24413,24419,24421,24439,24443,24469,24473,24481,24499,24509,24517,24527,24533,24547,24551,24571,24593,24611,24623,24631,24659,24671,24677,24683,24691,24697,24709,24733,24749,24763,24767,24781,24793,24799,24809,24821,24841,24847,24851,24859,24877,24889,24907,24917,24919,24923,24943,24953,24967,24971,24977,24979,24989,25013,25031,25033,25037,25057,25073,25087,25097,25111,25117,25121,25127,25147,25153,25163,25169,25171,25183,25189,25219,25229,25237,25243,25247,25253,25261,25301,25303,25307,25309,25321,25339,25343,25349,25357,25367,25373,25391,25409,25411,25423,25439,25447,25453,25457,25463,25469,25471,25523,25537,25541,25561,25577,25579,25583,25589,25601,25603,25609,25621,25633,25639,25643,25657,25667,25673,25679,25693,25703,25717,25733,25741,25747,25759,25763,25771,25793,25799,25801,25819,25841,25847,25849,25867,25873,25889,25903,25913,25919,25931,25933,25939,25943,25951,25969,25981,25997,25999,26003,26017,26021,26029,26041,26053,26083,26099,26107,26111,26113,26119,26141,26153,26161,26171,26177,26183,26189,26203,26209,26227,26237,26249,26251,26261,26263,26267,26293,26297,26309,26317,26321,26339,26347,26357,26371,26387,26393,26399,26407,26417,26423,26431,26437,26449,26459,26479,26489,26497,26501,26513,26539,26557,26561,26573,26591,26597,26627,26633,26641,26647,26669,26681,26683,26687,26693,26699,26701,26711,26713,26717,26723,26729,26731,26737,26759,26777,26783,26801,26813,26821,26833,26839,26849,26861,26863,26879,26881,26891,26893,26903,26921,26927,26947,26951,26953,26959,26981,26987,26993,27011,27017,27031,27043,27059,27061,27067,27073,27077,27091,27103,27107,27109,27127,27143,27179,27191,27197,27211,27239,27241,27253,27259,27271,27277,27281,27283,27299,27329,27337,27361,27367,27397,27407,27409,27427,27431,27437,27449,27457,27479,27481,27487,27509,27527,27529,27539,27541,27551,27581,27583,27611,27617,27631,27647,27653,27673,27689,27691,27697,27701,27733,27737,27739,27743,27749,27751,27763,27767,27773,27779,27791,27793,27799,27803,27809,27817,27823,27827,27847,27851,27883,27893,27901,27917,27919,27941,27943,27947,27953,27961,27967,27983,27997,28001,28019,28027,28031,28051,28057,28069,28081,28087,28097,28099,28109,28111,28123,28151,28163,28181,28183,28201,28211,28219,28229,28277,28279,28283,28289,28297,28307,28309,28319,28349,28351,28387,28393,28403,28409,28411,28429,28433,28439,28447,28463,28477,28493,28499,28513,28517,28537,28541,28547,28549,28559,28571,28573,28579,28591,28597,28603,28607,28619,28621,28627,28631,28643,28649,28657,28661,28663,28669,28687,28697,28703,28711,28723,28729,28751,28753,28759,28771,28789,28793,28807,28813,28817,28837,28843,28859,28867,28871,28879,28901,28909,28921,28927,28933,28949,28961,28979,29009,29017,29021,29023,29027,29033,29059,29063,29077,29101,29123,29129,29131,29137,29147,29153,29167,29173,29179,29191,29201,29207,29209,29221,29231,29243,29251,29269,29287,29297,29303,29311,29327,29333,29339,29347,29363,29383,29387,29389,29399,29401,29411,29423,29429,29437,29443,29453,29473,29483,29501,29527,29531,29537,29567,29569,29573,29581,29587,29599,29611,29629,29633,29641,29663,29669,29671,29683,29717,29723,29741,29753,29759,29761,29789,29803,29819,29833,29837,29851,29863,29867,29873,29879,29881,29917,29921,29927,29947,29959,29983,29989,30011,30013,30029,30047,30059,30071,30089,30091,30097,30103,30109,30113,30119,30133,30137,30139,30161,30169,30181,30187,30197,30203,30211,30223,30241,30253,30259,30269,30271,30293,30307,30313,30319,30323,30341,30347,30367,30389,30391,30403,30427,30431,30449,30467,30469,30491,30493,30497,30509,30517,30529,30539,30553,30557,30559,30577,30593,30631,30637,30643,30649,30661,30671,30677,30689,30697,30703,30707,30713,30727,30757,30763,30773,30781,30803,30809,30817,30829,30839,30841,30851,30853,30859,30869,30871,30881,30893,30911,30931,30937,30941,30949,30971,30977,30983,31013,31019,31033,31039,31051,31063,31069,31079,31081,31091,31121,31123,31139,31147,31151,31153,31159,31177,31181,31183,31189,31193,31219,31223,31231,31237,31247,31249,31253,31259,31267,31271,31277,31307,31319,31321,31327,31333,31337,31357,31379,31387,31391,31393,31397,31469,31477,31481,31489,31511,31513,31517,31531,31541,31543,31547,31567,31573,31583,31601,31607,31627,31643,31649,31657,31663,31667,31687,31699,31721,31723,31727,31729,31741,31751,31769,31771,31793,31799,31817,31847,31849,31859,31873,31883,31891,31907,31957,31963,31973,31981,31991,32003,32009,32027,32029,32051,32057,32059,32063,32069,32077,32083,32089,32099,32117,32119,32141,32143,32159,32173,32183,32189,32191,32203,32213,32233,32237,32251,32257,32261,32297,32299,32303,32309,32321,32323,32327,32341,32353,32359,32363,32369,32371,32377,32381,32401,32411,32413,32423,32429,32441,32443,32467,32479,32491,32497,32503,32507,32531,32533,32537,32561,32563,32569,32573,32579,32587,32603,32609,32611,32621,32633,32647,32653,32687,32693,32707,32713,32717,32719,32749,TABMAX,TABMAX,TABMAX};
+	const int * IntPrimeDom::TP = &(IntPrimeDom::IP)[2];
+
+	int IntPrimeDom::isprime_Tabule(const int n)  const
+	{
+		int plus = LOGMAX >> 1;
+		int here = plus;
+		int a;
+		//        int loop = LOGMAX;
+		//        while (loop) {
+		for(int loop = LOGMAX;loop; (loop >>= 1) ) {
+			if ( (a = (TP[here] - n)) == 0) return 1;
+			if (a > 0)
+				here -= (++plus >>= 1);
+			else
+				here += (++plus >>= 1);
+			//            loop >>= 1;
+		}
+		return 0;
+	}
+
+
+	// JGD 08.06.2004
+	// FULLY POMPED from GMP-4.1.3
+
+	/*
+	   We are to determine if c is a perfect power, c = a ^ b.
+	   Assume c is divisible by 2^n and that codd = c/2^n is odd.
+	   Assume a is divisible by 2^m and that aodd = a/2^m is odd.
+	   It is always true that m divides n.
+
+	 * If n is prime, either 1) a is 2*aodd and b = n
+	 or 2) a = c and b = 1.
+	 So for n prime, we readily have a solution.
+	 * If n is factorable into the non-trivial factors p1,p2,...
+	 Since m divides n, m has a subset of n's factors and b = n / m.
+	 */
+
+	/* This is a naive approach to recognizing perfect powers.
+	   Many things can be improved.  In particular, we should use p-adic
+	   arithmetic for computing possible roots.  */
+
+	static const unsigned short primes[] =
+	{  2,  3,  5,  7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
+		59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113,127,131,
+		137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
+		227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,
+		313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
+		419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,
+		509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,
+		617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,
+		727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,
+		829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,
+		947,953,967,971,977,983,991,997,0
+	};
 #define SMALLEST_OMITTED_PRIME 1009
 
 #ifndef GIVABS
@@ -184,92 +197,95 @@ static const unsigned short primes[] =
 #endif
 
 
-unsigned int IntPrimeDom::isprimepower (Rep& q, const Rep& u) const
-{
-  unsigned long int prime;
-  unsigned long int n, n2;
-  int i;
-  unsigned long int rem;
-  Integer t(u);
-  int exact;
-  int usize = int(u.size());
-
-  if (usize == 0)
-    return 1;			/* consider 0 a perfect power */
-
-  n2 = (unsigned int)u;
-  if ( ( n2 & 3UL) == 2UL)
-    return 0;			/* 2 divides exactly once.  */
-
-  n2=0;
-  for( ; !( ((unsigned int)t) & 0x1) ; t>>=1, ++n2) {
-  }
-  if (usize<0 && n2 >0 && (n2 & 1) ==0)
-      return 0;
-
-  if (n2 >0) {
-      if (t == 1) {
-          q = 2;
-          return (unsigned int) (n2);
-      } else {
-          return 0;
-      }
-  }
-
-
-  Integer u2;
-
-  for (i = 1; primes[i] != 0; i++)
-    {
-        u2 = u;
-        prime = primes[i];
-
-        rem = u2 % prime;
-        if (rem == 0)		/* divisable by this prime? */
+	unsigned int IntPrimeDom::isprimepower (Rep& q, const Rep& u) const
 	{
-            Integer::divmod(q,rem,u2,prime * prime);
-            if (rem != 0)
-                return 0;	/* prime divides exactly once, reject */
-
-            swap (q, u2);
-            for (n = 2;;++n)
-	    {
-                Integer::divmod(q, rem, u2, prime);
-                if (rem != 0)
-                    break;
-                swap (q, u2);
-	    }
-
-            if ((n & 1) == 0 && usize < 0)
-                return 0;	/* even multiplicity with negative U, reject */
-
-            if (n > 0) {
-                if (GIVABS(u2) == 1) {
-                    q = Integer(prime);
-                    return (unsigned int) (n);
-                } else {
-                    return 0;
-                }
-            }
+		unsigned long int prime;
+		unsigned long int n, n2;
+		int i;
+		unsigned long int rem;
+		Integer t(u);
+		int exact;
+		int usize = int(u.size());
+
+		if (usize == 0)
+			return 1;			/* consider 0 a perfect power */
+
+		n2 = (unsigned int)u;
+		if ( ( n2 & 3UL) == 2UL)
+			return 0;			/* 2 divides exactly once.  */
+
+		n2=0;
+		for( ; !( ((unsigned int)t) & 0x1) ; t>>=1, ++n2) {
+		}
+		if (usize<0 && n2 >0 && (n2 & 1) ==0)
+			return 0;
+
+		if (n2 >0) {
+			if (t == 1) {
+				q = 2;
+				return (unsigned int) (n2);
+			} else {
+				return 0;
+			}
+		}
+
+
+		Integer u2;
+
+		for (i = 1; primes[i] != 0; i++)
+		{
+			u2 = u;
+			prime = primes[i];
+
+			rem = (unsigned long)(u2 % prime);
+			if (rem == 0)		/* divisable by this prime? */
+			{
+				Integer::divmod(q,rem,u2,prime * prime);
+				if (rem != 0)
+					return 0;	/* prime divides exactly once, reject */
+
+				swap (q, u2);
+				for (n = 2;;++n)
+				{
+					Integer::divmod(q, rem, u2, prime);
+					if (rem != 0)
+						break;
+					swap (q, u2);
+				}
+
+				if ((n & 1) == 0 && usize < 0)
+					return 0;	/* even multiplicity with negative U, reject */
+
+				if (n > 0) {
+					if (GIVABS(u2) == 1) {
+						q = Integer(prime);
+						return (unsigned int) (n);
+					} else {
+						return 0;
+					}
+				}
+			}
+		}
+
+		/* We found no factors above; have to check all values of n.  */
+		unsigned long int nth;
+		for (nth = (usize < 0 ? 3 : 2);; ++nth)
+		{
+			if (! isprime (nth))
+				continue;
+			exact = root (q, u2, (unsigned int)nth);
+			if (exact) {
+				if (isprime(q))
+					return (unsigned int)nth;
+				else
+					return 0;
+			}
+			if (GIVABS(q) < SMALLEST_OMITTED_PRIME)
+				return 0;
+		}
 	}
-    }
-
-      /* We found no factors above; have to check all values of n.  */
-  unsigned long int nth;
-  for (nth = (usize < 0 ? 3 : 2);; ++nth)
-  {
-      if (! isprime (nth))
-          continue;
-      exact = root (q, u2, (unsigned int)nth);
-      if (exact) {
-          if (isprime(q))
-              return (unsigned int)nth;
-          else
-              return 0;
-      }
-      if (GIVABS(q) < SMALLEST_OMITTED_PRIME)
-          return 0;
-  }
-}
 
 } // Givaro
+
+#endif // __GIVARO_integer_givintprime_C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/integer/givintprime.h b/src/kernel/integer/givintprime.h
index 501ad83..a0ab321 100644
--- a/src/kernel/integer/givintprime.h
+++ b/src/kernel/integer/givintprime.h
@@ -4,13 +4,20 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : Prime numbers
-//              Modular powering,
-//              Fermat numbers,
-//              Primality tests, Factorization :
-//                      (There are parameters to fix)
 // Time-stamp: <06 Jun 06 14:48:16 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
+
+
+/*! @file givintprime.h
+ * @ingroup integers
+ * @brief primes
+ * - Prime numbers
+ * - Modular powering,
+ * - Fermat numbers,
+ * - Primality tests
+ * - Factorization : (There are parameters to fix)
+ * .
+ */
 #ifndef __GIVARO_integers_prime_H
 #define __GIVARO_integers_prime_H
 
@@ -23,7 +30,7 @@
 namespace Givaro {
 
 	// =================================================================== //
-	// Fermat numbers
+	//! Fermat numbers
 	// =================================================================== //
 	class FermatDom : public IntegerDom {
 	public:
@@ -51,7 +58,7 @@ namespace Givaro {
 #define BOUNDARY_2_isprime TABMAX2
 
 	// =================================================================== //
-	// Primality tests
+	//! Primality tests
 	// =================================================================== //
 	class IntPrimeDom : public IntegerDom {
 	public:
diff --git a/src/kernel/integer/givintrns.h b/src/kernel/integer/givintrns.h
index 8f8377d..809eb47 100644
--- a/src/kernel/integer/givintrns.h
+++ b/src/kernel/integer/givintrns.h
@@ -7,9 +7,13 @@
 // Authors: T. Gautier
 // Time-stamp: <08 Feb 02 16:33:39 Jean-Guillaume.Dumas at imag.fr>
 // ==========================================================================
-// Description:
-//  Modular arithmetic for GIVARO. Here is defined arithmetic functions
-//  on rns representation with Givaro Integers.
+/** @file givintrns.h
+ * @ingroup CRA
+ * @brief arithmetic for RNS representations.
+ *  Modular arithmetic for GIVARO. Here is defined arithmetic functions
+ * on rns representation with Givaro Integers.
+ */
+
 #ifndef __GIVARO__arithmodu_intrns_H
 #define __GIVARO__arithmodu_intrns_H
 
@@ -20,172 +24,177 @@
 // Structure which manages list of primes in order to do
 
 namespace Givaro {
-// #ifndef __ECC
-template< template<class, class> class Container, template <class> class Alloc>
-class IntRNSsystem : public IntegerDom {
-public:
-//     typedef Element    Ring;
-//     typedef Element   Modulo;
-    typedef Element   external;
-    typedef Container< Element, Alloc<Element> > array;
+	// #ifndef __ECC
+
+	//! RNS system class. No doc.
+	template< template<class, class> class Container, template <class> class Alloc>
+	class IntRNSsystem : public IntegerDom {
+	public:
+		//     typedef Element    Ring;
+		//     typedef Element   Modulo;
+		typedef Element   external;
+		typedef Container< Element, Alloc<Element> > array;
 
 
-        // Default Cstor, Dstor/Cstor of recopy:
-	// -- free memory allocated in array !
-    IntRNSsystem() : _primes(0), _prod(one), _ck(0) {}
-    ~IntRNSsystem(){}
-    IntRNSsystem(const IntRNSsystem& R) : _primes(R._primes), _prod(R._prod), _ck(R._primes) {}
+		// Default Cstor, Dstor/Cstor of recopy:
+		// -- free memory allocated in array !
+		IntRNSsystem() : _primes(0), _prod(one), _ck(0) {}
+		~IntRNSsystem(){}
+		IntRNSsystem(const IntRNSsystem& R) : _primes(R._primes), _prod(R._prod), _ck(R._primes) {}
 
-        // -- Cstor with given primes
-    IntRNSsystem( const array& primes );
+		// -- Cstor with given primes
+		IntRNSsystem( const array& primes );
 
-    template<class TT>
-      IntRNSsystem( const Container< TT, Alloc<TT> > & primes );
+		template<class TT>
+		IntRNSsystem( const Container< TT, Alloc<TT> > & primes );
 
-        // -- Computation of a mixed-radix representation of the residus.
-//     void RnsToMixedRadix(array&  mixrad, const array&  residu) const;
-    template<class TT>
-      void RnsToMixedRadix(array&  mixrad, const Container<TT, Alloc<TT> >&  residu) ;
+		// -- Computation of a mixed-radix representation of the residus.
+		//     void RnsToMixedRadix(array&  mixrad, const array&  residu) const;
+		template<class TT>
+		void RnsToMixedRadix(array&  mixrad, const Container<TT, Alloc<TT> >&  residu) ;
 
-        // -- Convert a mixed radix representation to an external
-    void MixedRadixToRing( external& res,  const array& mixrad ) const;
+		// -- Convert a mixed radix representation to an external
+		void MixedRadixToRing( external& res,  const array& mixrad ) const;
 
-        // -- Convert an Ring Element to a its representation
-        // with the "this" rns system.
-    void RingToRns( array& residu, const external& a ) ;
+		// -- Convert an Ring Element to a its representation
+		// with the "this" rns system.
+		void RingToRns( array& residu, const external& a ) ;
 
-        // -- Fast conversion: requires pre-computation (first time it was called)
-    void fastRingToRns( array& residu, const external& a ) const;
+		// -- Fast conversion: requires pre-computation (first time it was called)
+		void fastRingToRns( array& residu, const external& a ) const;
 
-        // -- Convert a representation to an external Element
-    template<class TT>
-      void RnsToRing( external& a, const Container<TT, Alloc<TT> >& residu ) ;
+		// -- Convert a representation to an external Element
+		template<class TT>
+		void RnsToRing( external& a, const Container<TT, Alloc<TT> >& residu ) ;
 
-        // -- Fast conversion: requires pre-computation (first time it was called)
-    void fastRnsToRing( external& a, const array& residu ) const;
+		// -- Fast conversion: requires pre-computation (first time it was called)
+		void fastRnsToRing( external& a, const array& residu ) const;
 
-        // ------------- Access methods
+		// ------------- Access methods
 
-        // -- Returns the number of primes of this ctxt
-    int NumOfPrimes() const { return _primes.size(); }
+		// -- Returns the number of primes of this ctxt
+		int NumOfPrimes() const { return _primes.size(); }
 
-        // -- Returns a array to the begin of the array of primes
-    const array& Primes() const;
-        // -- Returns the ith primes of the rns system
-    const Element ith(const size_t i) const;
+		// -- Returns a array to the begin of the array of primes
+		const array& Primes() const;
+		// -- Returns the ith primes of the rns system
+		const Element ith(const size_t i) const;
 
-        // -- Returns a array of the reciprocal ck = (\prod_{j=0..k-1)p_j)^(-1) [pk]
-    const array& Reciprocals() const;
-    const Element reciprocal(const size_t i) const;
-    const Element product() const;
+		// -- Returns a array of the reciprocal ck = (\prod_{j=0..k-1)p_j)^(-1) [pk]
+		const array& Reciprocals() const;
+		const Element reciprocal(const size_t i) const;
+		const Element product() const;
 
-protected:
-        // -- Compute some fields of the structure :
-    void ComputeCk();
+	protected:
+		// -- Compute some fields of the structure :
+		void ComputeCk();
 
-        // -- Compute product of primes
-    void ComputeProd();
+		// -- Compute product of primes
+		void ComputeProd();
 
-        // -- Compute the Qk for Ring -> RNS, allocate U
-    void ComputeQk();
+		// -- Compute the Qk for Ring -> RNS, allocate U
+		void ComputeQk();
 
-    array  _primes; 	// - array of the relatively primes numbers
-    Element _prod;      // - product of primes
-    array  _ck;     	// - reciprocals, _ck[0] = 1, same size as _primes
+		array  _primes; 	// - array of the relatively primes numbers
+		Element _prod;      // - product of primes
+		array  _ck;     	// - reciprocals, _ck[0] = 1, same size as _primes
 
-        // -- for fast conversion
-    size_t _sizek;
-    size_t _log2k;
-    array  _qk;	// - cf algo Aho, Hopcroft & Ullman
-    array  _u;	// - cf algo Aho, Hopcroft & Ullman
-};
-// #endif
+		// -- for fast conversion
+		size_t _sizek;
+		size_t _log2k;
+		array  _qk;	// - cf algo Aho, Hopcroft & Ullman
+		array  _u;	// - cf algo Aho, Hopcroft & Ullman
+	};
+	// #endif
 
 #if 0 // defined(__ECC)
-//#else
-/* template<class Container> */
-/* class IntRNSsystem : public IntegerDom { */
-/* public: */
-/* //     typedef Element    Ring; */
-/* //     typedef Element   Modulo; */
-/*     typedef Element   external; */
-/*     typedef Container array; */
-
-
-/*         // Default Cstor, Dstor/Cstor of recopy:  */
-/* 	// -- free memory allocated in array ! */
-/*     IntRNSsystem() : _primes(0), _prod(one), _ck(0) {} */
-/*     ~IntRNSsystem(){}  */
-/*     IntRNSsystem(const IntRNSsystem& R) : _primes(R._primes), _prod(R._prod), _ck(R._primes) {} */
-
-/*         // -- Cstor with given primes  */
-/*     IntRNSsystem( const array& primes ); */
-
-/*     template<class ContTT> */
-/*     IntRNSsystem( const ContTT& primes ); */
-
-/*         // -- Computation of a mixed-radix representation of the residus. */
-/* //     void RnsToMixedRadix(array&  mixrad, const array&  residu) const;  */
-/*     template<class ContTT> */
-/*     void RnsToMixedRadix(array&  mixrad, const ContTT&  residu) const;  */
-
-/*         // -- Convert a mixed radix representation to an external */
-/*     void MixedRadixToRing( external& res,  const array& mixrad ) const; */
-
-/*         // -- Convert an Ring Element to a its representation */
-/*         // with the "this" rns system. */
-/*     void RingToRns( array& residu, const external& a ) const; */
-
-/*         // -- Fast conversion: requires pre-computation (first time it was called) */
-/*     void fastRingToRns( array& residu, const external& a ) const; */
-
-/*         // -- Convert a representation to an external Element */
-/*     template<class ContTT> */
-/*     void RnsToRing( external& a, const ContTT& residu ) const; */
-
-/*         // -- Fast conversion: requires pre-computation (first time it was called) */
-/*     void fastRnsToRing( external& a, const array& residu ) const; */
-
-/*         // ------------- Access methods */
-
-/*         // -- Returns the number of primes of this ctxt */
-/*     int NumOfPrimes() const { return _primes.size(); }  */
-
-/*         // -- Returns a array to the begin of the array of primes */
-/*     const array& Primes() const; */
-/*         // -- Returns the ith primes of the rns system */
-/*     const Element ith(const size_t i) const; */
-
-/*         // -- Returns a array of the reciprocal ck = (\prod_{j=0..k-1)p_j)^(-1) [pk] */
-/*     const array& Reciprocals() const; */
-/*     const Element reciprocal(const size_t i) const; */
-/*     const Element product() const; */
-
-/* protected: */
-/*         // -- Compute some fields of the structure : */
-/*     void ComputeCk(); */
-
-/*         // -- Compute product of primes */
-/*     void ComputeProd(); */
-
-/*         // -- Compute the Qk for Ring -> RNS, allocate U */
-/*     void ComputeQk(); */
-
-/*     array  _primes; 	// - array of the relatively primes numbers */
-/*     Element _prod;      // - product of primes */
-/*     array  _ck;     	// - reciprocals, _ck[0] = 1, same size as _primes  */
-
-/*         // -- for fast conversion */
-/*     size_t _sizek; */
-/*     size_t _log2k; */
-/*     array  _qk;	// - cf algo Aho, Hopcroft & Ullman */
-/*     array  _u;	// - cf algo Aho, Hopcroft & Ullman */
-/* }; */
-/* #endif */
+	//#else
+	/* template<class Container> */
+	/* class IntRNSsystem : public IntegerDom { */
+	/* public: */
+	/* //     typedef Element    Ring; */
+	/* //     typedef Element   Modulo; */
+	/*     typedef Element   external; */
+	/*     typedef Container array; */
+
+
+	/*         // Default Cstor, Dstor/Cstor of recopy:  */
+	/* 	// -- free memory allocated in array ! */
+	/*     IntRNSsystem() : _primes(0), _prod(one), _ck(0) {} */
+	/*     ~IntRNSsystem(){}  */
+	/*     IntRNSsystem(const IntRNSsystem& R) : _primes(R._primes), _prod(R._prod), _ck(R._primes) {} */
+
+	/*         // -- Cstor with given primes  */
+	/*     IntRNSsystem( const array& primes ); */
+
+	/*     template<class ContTT> */
+	/*     IntRNSsystem( const ContTT& primes ); */
+
+	/*         // -- Computation of a mixed-radix representation of the residus. */
+	/* //     void RnsToMixedRadix(array&  mixrad, const array&  residu) const;  */
+	/*     template<class ContTT> */
+	/*     void RnsToMixedRadix(array&  mixrad, const ContTT&  residu) const;  */
+
+	/*         // -- Convert a mixed radix representation to an external */
+	/*     void MixedRadixToRing( external& res,  const array& mixrad ) const; */
+
+	/*         // -- Convert an Ring Element to a its representation */
+	/*         // with the "this" rns system. */
+	/*     void RingToRns( array& residu, const external& a ) const; */
+
+	/*         // -- Fast conversion: requires pre-computation (first time it was called) */
+	/*     void fastRingToRns( array& residu, const external& a ) const; */
+
+	/*         // -- Convert a representation to an external Element */
+	/*     template<class ContTT> */
+	/*     void RnsToRing( external& a, const ContTT& residu ) const; */
+
+	/*         // -- Fast conversion: requires pre-computation (first time it was called) */
+	/*     void fastRnsToRing( external& a, const array& residu ) const; */
+
+	/*         // ------------- Access methods */
+
+	/*         // -- Returns the number of primes of this ctxt */
+	/*     int NumOfPrimes() const { return _primes.size(); }  */
+
+	/*         // -- Returns a array to the begin of the array of primes */
+	/*     const array& Primes() const; */
+	/*         // -- Returns the ith primes of the rns system */
+	/*     const Element ith(const size_t i) const; */
+
+	/*         // -- Returns a array of the reciprocal ck = (\prod_{j=0..k-1)p_j)^(-1) [pk] */
+	/*     const array& Reciprocals() const; */
+	/*     const Element reciprocal(const size_t i) const; */
+	/*     const Element product() const; */
+
+	/* protected: */
+	/*         // -- Compute some fields of the structure : */
+	/*     void ComputeCk(); */
+
+	/*         // -- Compute product of primes */
+	/*     void ComputeProd(); */
+
+	/*         // -- Compute the Qk for Ring -> RNS, allocate U */
+	/*     void ComputeQk(); */
+
+	/*     array  _primes; 	// - array of the relatively primes numbers */
+	/*     Element _prod;      // - product of primes */
+	/*     array  _ck;     	// - reciprocals, _ck[0] = 1, same size as _primes  */
+
+	/*         // -- for fast conversion */
+	/*     size_t _sizek; */
+	/*     size_t _log2k; */
+	/*     array  _qk;	// - cf algo Aho, Hopcroft & Ullman */
+	/*     array  _u;	// - cf algo Aho, Hopcroft & Ullman */
+	/* }; */
+	/* #endif */
 #endif
 
 } // Givaro
+
 #include "givaro/givintrns_cstor.inl"
 #include "givaro/givintrns_convert.inl"
 
 #endif // __GIVARO__arithmodu_intrns_H
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/integer/givintrns_convert.inl b/src/kernel/integer/givintrns_convert.inl
index 34f101c..d60cbff 100644
--- a/src/kernel/integer/givintrns_convert.inl
+++ b/src/kernel/integer/givintrns_convert.inl
@@ -35,9 +35,9 @@ namespace Givaro {
 			// Horner scheme
 			tmp = mixrad[i-1];
 			// JGD 16.04.2003, Si i==1 !!!!!!!
-			for (long j= i-1; j--; ) {
+			for (long j= (long)i-1; j--; ) {
 				//  std::cerr << tmp << " * " << _primes[j] << " + " << mixrad[j] << " mod " << _primes[i] << " = ";
-				modin( addin( mulin(tmp, _primes[j]), mixrad[j]), _primes[i]);
+				modin( addin( mulin(tmp, _primes[(size_t)j]), mixrad[(size_t)j]), _primes[i]);
 				//  std::cerr << tmp << ";#Horner scheme" << std::endl;
 			}
 			// - m_i = (r_i - pp_i)*ck_i, ck is reciprocals
@@ -77,11 +77,11 @@ namespace Givaro {
 	//#endif
 	inline void IntRNSsystem< Container, Alloc >::RingToRns( IntRNSsystem< Container, Alloc >::array& rns , const external& a)
 	{
-		size_t size = _primes.size();
-		if (rns.size() != size) rns.resize(size);
+		size_t mysize = _primes.size();
+		if (rns.size() != mysize) rns.resize(mysize);
 		// -- may be faster using the recursive
 		// tree algorithm a mod p_1...p_k/2, and a mod p_k/2+1...p_k
-		for (int i=0; i<size; i++)
+		for (int i=0; i<(int)mysize; i++)
 			mod( rns[i], a, _primes[i]);
 		//     rns[i] = mod(a, _primes[i]);
 	}
diff --git a/src/kernel/integer/givintrns_cstor.inl b/src/kernel/integer/givintrns_cstor.inl
index 5c357af..3ad28ab 100644
--- a/src/kernel/integer/givintrns_cstor.inl
+++ b/src/kernel/integer/givintrns_cstor.inl
@@ -4,6 +4,11 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 
+/*!@internal
+ * @file integer/givintrns_cstor.inl
+ * @brief NO DOC
+ */
+
 #ifndef __GIVARO_intrns_cstor_INL
 #define __GIVARO_intrns_cstor_INL
 
@@ -15,9 +20,9 @@ namespace Givaro {
 	//#else
 	template<template <class,class> class Container, template <class> class Alloc>
 	//#endif
-	inline IntRNSsystem<Container, Alloc>::IntRNSsystem( const IntRNSsystem<Container, Alloc>::array& inprimes)
-	: _primes(inprimes),
-	_prod(one), _ck(0)
+	inline IntRNSsystem<Container, Alloc>::IntRNSsystem( const array& inprimes) :
+		_primes(inprimes),
+		_prod(one), _ck(0)
 	{
 		GIVARO_ASSERT( inprimes.size()>0, "[IntRNSsystem::IntRNSsystem] bad size of array");
 	}
diff --git a/src/kernel/integer/givintrsa.h b/src/kernel/integer/givintrsa.h
index 1a60f54..a6a9d87 100644
--- a/src/kernel/integer/givintrsa.h
+++ b/src/kernel/integer/givintrsa.h
@@ -4,10 +4,14 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : RSA scheme.
 // Time-stamp: <07 May 09 13:51:58 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
 
+/** @file givintrsa.h
+ * @ingroup integers
+ * @brief RSA scheme.
+ */
+
 #ifndef __GIVARO_rsa_H
 #define __GIVARO_rsa_H
 
@@ -27,6 +31,7 @@
 
 namespace Givaro {
 
+	//! RSA domain
 template<class RandIter = GivRandom>
 class IntRSADom : public IntFactorDom<RandIter> {
 public:
@@ -45,26 +50,51 @@ private:
 public:
 
 // =================================================================== //
-// Constructors
-// =================================================================== //
-    IntRSADom(bool fi = false, RandIter g = RandIter() ) : IntFactorDom<RandIter>(g), _fast_impl(fi) { keys_gen(IntFactorDom<RandIter>::_g, 257, 255, _n, _e, _d); _lm = log(_n,1<<(8*sizeof(unsigned char))); }
-    IntRSADom(const long s, bool fi = false, RandIter g = RandIter() ) : IntFactorDom<RandIter>(g), _fast_impl(fi)  { keys_gen(IntFactorDom<RandIter>::_g, (s>>1)-1, (s>>1)+1, _n, _e, _d); _lm = log(_n,1<<(8*sizeof(unsigned char))); }
-    IntRSADom(const long p, const long q, bool fi = false, RandIter g = RandIter() ) : IntFactorDom<RandIter>(g), _fast_impl(fi)  { keys_gen(IntFactorDom<RandIter>::_g, p, q, _n, _e, _d); _lm = log(_n,1<<(8*sizeof(unsigned char))); }
-    IntRSADom(const Element& n, const Element& e, const Element& d) : _n(n), _e(e), _d(d), _lm(log(n,1<<(8*sizeof(unsigned char)))), _fast_impl( e == SIMPLE_EXPONENT )  {}
-    IntRSADom(const Element& n, const Element& e) : _n(n), _e(e), _d(0), _lm(log(n,1<<(8*sizeof(unsigned char)))), _fast_impl( e == SIMPLE_EXPONENT )  {}
-
-// =================================================================== //
-// Accesses
-// =================================================================== //
+//! Constructors
+// =================================================================== //
+//@{
+    IntRSADom(bool fi = false, RandIter g = RandIter() ) :
+		IntFactorDom<RandIter>(g), _fast_impl(fi)
+	{
+	   	keys_gen(IntFactorDom<RandIter>::_g, 257, 255, _n, _e, _d);
+	   	_lm = log(_n,1<<(8*sizeof(unsigned char)));
+   	}
+    IntRSADom(const long s, bool fi = false, RandIter g = RandIter() ) :
+		IntFactorDom<RandIter>(g), _fast_impl(fi)
+	{
+	   	keys_gen(IntFactorDom<RandIter>::_g, (s>>1)-1, (s>>1)+1, _n, _e, _d);
+	   	_lm = log(_n,1<<(8*sizeof(unsigned char)));
+	}
+    IntRSADom(const long p, const long q, bool fi = false, RandIter g = RandIter() ) :
+	   	IntFactorDom<RandIter>(g), _fast_impl(fi)
+   	{
+	   	keys_gen(IntFactorDom<RandIter>::_g, p, q, _n, _e, _d);
+	   	_lm = log(_n,1<<(8*sizeof(unsigned char)));
+	}
+    IntRSADom(const Element& n, const Element& e, const Element& d) :
+	   	_n(n), _e(e), _d(d), _lm(log(n,1<<(8*sizeof(unsigned char)))), _fast_impl( e == SIMPLE_EXPONENT )
+   	{}
+    IntRSADom(const Element& n, const Element& e) :
+	   	_n(n), _e(e), _d(0), _lm(log(n,1<<(8*sizeof(unsigned char)))), _fast_impl( e == SIMPLE_EXPONENT )
+	{}
+	//@}
+
+// =================================================================== //
+//! Accesses
+// =================================================================== //
+//@{
     const Element& getn() const { return _n; }
     const Element& gete() const { return _e; }
     const Element& getd() const { return _d; }
+//@}
 
 // =================================================================== //
-// Text conversions
+//! Text conversions
 // =================================================================== //
+//@{
     std::ostream& encipher(std::ostream&, std::istream&) const ;
     std::ostream& decipher(std::ostream&, std::istream&) ;
+	//@}
 
 // =================================================================== //
 // Keys generation
@@ -76,40 +106,47 @@ public:
 
 
 // =================================================================== //
-// [Strong Primes Are Easy to Find, J. Gordon, EUROCRYPT'84, LNCS 209
+/*! Strong Primes.
+ * @bib
+ * - J. Gordon, <i>Strong Primes Are Easy to Find</i>,  EUROCRYPT'84, LNCS 209.
+ */
 // =================================================================== //
     Element& strong_prime(random_generator& g, long psize, Element& p) const;
 
 // =================================================================== //
-// Here m = p*q
-// p and q are prime numbers of respective sizes psize, qsize
-// Moreover p-1 and q-1 have one prime factor of respective size 2/3
-// since k.u = 1 mod (p-1)(q-1)
+/** Key gen.
+ * Here m = p*q
+ * p and q are prime numbers of respective sizes psize, qsize
+ * Moreover p-1 and q-1 have one prime factor of respective size 2/3
+ * since k.u = 1 mod (p-1)(q-1)
+ */
 // =================================================================== //
+//@{
     void keys_gen(random_generator& g, long psize, long qsize, Element& n, Element& e, Element& d, Element& p, Element& q) const ;
     void keys_gen(random_generator& g, long psize, long qsize, Element& n, Element& e, Element& d) const ;
+	//@}
 
 // =================================================================== //
-// log[10]
+//! log[10]
 // =================================================================== //
-    long log(const Element& n, const long) const ;
+    long log(const Element& n, const long = 10) const ;
 
 // =================================================================== //
-// Text conversions
+//! Text conversions
 // =================================================================== //
     std::ostream& ecriture_str(std::ostream&, const Element&) const ;
     std::ostream& ecriture_str_last(std::ostream&, const Element&) const ;
     std::ostream& ecriture_Int(std::ostream&, const Element&) const ;
 
 // =================================================================== //
-// Breaking codes : finding u knowing only m an k ...
+//! Breaking codes : finding u knowing only m an k ...
 // =================================================================== //
     Element& point_break(Element& u) ;
 
 protected:
-// Fast implementation
-// Means simple enciphering key, and deciphering via chinese remaindering
-// WARNING: this means less security !
+//! Fast implementation.
+//! Means simple enciphering key, and deciphering via chinese remaindering.
+//! @warning this means less security !
     bool _fast_impl;
 
 };
diff --git a/src/kernel/integer/givintrsa.inl b/src/kernel/integer/givintrsa.inl
index 972b378..a529cab 100644
--- a/src/kernel/integer/givintrsa.inl
+++ b/src/kernel/integer/givintrsa.inl
@@ -25,7 +25,8 @@ namespace Givaro {
 	// =================================================================== //
 
 	template<class RandIter>
-	long IntRSADom<RandIter>::log(const Element& n, const long b = 10) const {
+	long IntRSADom<RandIter>::log(const Element& n, const long b ) const
+	{
 		long res = 0;
 		for(Element p = n; p>=b; ++res, this->divin(p,b) ) {}
 		return res;
@@ -38,7 +39,8 @@ namespace Givaro {
 
 
 	template<class RandIter>
-	std::ostream& IntRSADom<RandIter>::ecriture_str(std::ostream& o, const Element& n) const {
+	std::ostream& IntRSADom<RandIter>::ecriture_str(std::ostream& o, const Element& n) const
+	{
 
 		Element p = n, a, b;
 		long i = _lm-1;
@@ -54,7 +56,8 @@ namespace Givaro {
 	}
 
 	template<class RandIter>
-	std::ostream& IntRSADom<RandIter>::ecriture_str_last(std::ostream& o, const Element& n) const {
+	std::ostream& IntRSADom<RandIter>::ecriture_str_last(std::ostream& o, const Element& n) const
+	{
 		Element p = n, a, b;
 		long i = _lm-1, nbzeroes(0);
 		// First char is ignored as it is zero or this->random enabling CBC
@@ -78,7 +81,8 @@ namespace Givaro {
 
 
 	template<class RandIter>
-	std::ostream& IntRSADom<RandIter>::ecriture_Int(std::ostream& o, const Element& p) const {
+	std::ostream& IntRSADom<RandIter>::ecriture_Int(std::ostream& o, const Element& p) const
+	{
 		return o << p << std::endl;
 	}
 
@@ -87,7 +91,8 @@ namespace Givaro {
 
 	// CBC mode enciphering
 	template<class RandIter>
-	std::ostream& IntRSADom<RandIter>::encipher(std::ostream& o, std::istream& in) const {
+	std::ostream& IntRSADom<RandIter>::encipher(std::ostream& o, std::istream& in) const
+	{
 		RandIter generator;
 		unsigned char x;
 		Element res,r;
@@ -122,9 +127,10 @@ namespace Givaro {
 
 	// CBC mode deciphering
 	template<class RandIter>
-	std::ostream& IntRSADom<RandIter>::decipher(std::ostream& o, std::istream& in) {
+	std::ostream& IntRSADom<RandIter>::decipher(std::ostream& o, std::istream& in)
+	{
 		double Length = (double) _lm * 2.4082399653118495617; // _lm * 8*log[10](2)
-		char * tmp = new char[(long)Length+2];
+		char * tmp = new char[(size_t)Length+2];
 		Element r;
 		unsigned long seed; in >> seed;
 		GivRandom generator(seed);
@@ -196,7 +202,8 @@ namespace Givaro {
 
 
 	template<class RandIter>
-	typename IntRSADom<RandIter>::Element& IntRSADom<RandIter>::strong_prime(random_generator& g, long psize, Element& p) const {
+	typename IntRSADom<RandIter>::Element& IntRSADom<RandIter>::strong_prime(random_generator& g, long psize, Element& p) const
+	{
 		Element q,t,r,s;
 
 		if (psize > 9) {
@@ -208,14 +215,14 @@ namespace Givaro {
 			this->random(g,t,3);
 			this->random(g,s,3);
 		}
-		nextprimein( t );
-		nextprimein( s );
+		this->nextprimein( t );
+		this->nextprimein( s );
 
 
 
 		r = t<<1;
 		++r;
-		while( ! isprime(r,4) ) {
+		while( ! this->isprime(r,4) ) {
 			r += t<<1;
 		}
 
@@ -234,7 +241,7 @@ namespace Givaro {
 		r <<= 1;
 
 		p = q+r;
-		while( ! isprime(p,4) ) {
+		while( ! this->isprime(p,4) ) {
 			p += r;
 		}
 
@@ -252,47 +259,56 @@ namespace Givaro {
 	// since for any x, x^(k.u) = x mod m
 	// =================================================================== //
 	template<class RandIter>
-	void IntRSADom<RandIter>::keys_gen(random_generator& g, long psize, long qsize, Element& m, Element& k, Element& u) const {
+	void IntRSADom<RandIter>::keys_gen(random_generator& g, long psize, long qsize, Element& m, Element& k, Element& u) const
+	{
 		Element p, q;
 		keys_gen(g,psize,qsize,m,k,u,p,q);
 	}
 
 	template<class RandIter>
-	void IntRSADom<RandIter>::keys_gen(random_generator& g, long psize, long qsize, Element& m, Element& k, Element& u, Element& p, Element& q) const {
+	void IntRSADom<RandIter>::keys_gen(random_generator& g, long psize, long qsize, Element& m, Element& k, Element& u, Element& p, Element& q) const
+	{
 		Element d, l;
 
 		strong_prime(g, psize, p);
 		do  strong_prime(g, qsize, q); while (q == p);
 
 
-		Element phim; mul(phim, sub(d,p,IntFactorDom<RandIter>::one), sub(l,q,IntFactorDom<RandIter>::one));
-		mul(m, p, q);
+		Element phim;
+		this->mul(phim,
+			  this-> sub(d,p,IntFactorDom<RandIter>::one),
+			  this-> sub(l,q,IntFactorDom<RandIter>::one));
+		this->mul(m, p, q);
 
 		Element v, gd;
 
 		if (_fast_impl) {
-			mod(k,SIMPLE_EXPONENT, phim);
+			this->mod(k,SIMPLE_EXPONENT, phim);
 			this->gcd(gd,u,v,k,phim);
 		} else {
 			do {
 				this->random(g,k,phim);
 			} while (this->gcd(gd,u,v,k,phim) != 1);
 		}
-		modin(u,phim);
-		if ( islt(u,IntFactorDom<RandIter>::zero) ) addin(u,phim);
+		this->modin(u,phim);
+		if ( this->islt(u,IntFactorDom<RandIter>::zero) )
+			this->addin(u,phim);
 	}
 
 	// =================================================================== //
 	// Breaking codes
 	// =================================================================== //
 	template<class RandIter>
-	typename IntRSADom<RandIter>::Element& IntRSADom<RandIter>::point_break(Element& u) {
+	typename IntRSADom<RandIter>::Element& IntRSADom<RandIter>::point_break(Element& u)
+	{
 		if ( isZero(_d) ) {
 			Element p,v,d, pm;
-			factor(p, _n);
-			mul(pm, sub(v,p,IntFactorDom<RandIter>::one), subin( this->div(d,_n,p), IntFactorDom<RandIter>::one ) );
+			this->factor(p, _n);
+			this->mul(pm, this->sub(v,p,IntFactorDom<RandIter>::one),
+			    this->subin( this->div(d,_n,p), IntFactorDom<RandIter>::one ) );
 			this->gcd(d,_d,v,_e,pm);
-			if (islt(_d,IntFactorDom<RandIter>::zero)) addin(_d, pm);
+			if (this->islt(_d,IntFactorDom<RandIter>::zero))
+			       this->	addin(_d, pm);
 		}
 		return u = _d;
 	}
diff --git a/src/kernel/integer/givintsqrootmod.h b/src/kernel/integer/givintsqrootmod.h
index 8d7e5e5..27ef946 100644
--- a/src/kernel/integer/givintsqrootmod.h
+++ b/src/kernel/integer/givintsqrootmod.h
@@ -5,11 +5,15 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 // Time-stamp: <19 Jan 11 15:53:22 Jean-Guillaume.Dumas at imag.fr>
-// Givaro : Modular square roots
 // Author : Yanis Linge
 // ============================================================= //
 
 
+/** @file givintsqrootmod.h
+ * @ingroup integers
+ * @brief Modular square roots
+ */
+
 #ifndef __GIVARO_sqrtmod_H
 #define __GIVARO_sqrtmod_H
 
@@ -24,6 +28,7 @@
 
 namespace Givaro {
 
+	//!  Modular square roots.
 template < class RandIter = GivRandom >
 class IntSqrtModDom:public IntFactorDom < RandIter > {
 public:
@@ -50,7 +55,7 @@ public:
         std::vector < Rep > Pe (Lf.size ());
         typename std::vector < Rep >::iterator Pe_iter = Pe.begin ();
         for (; Pe_iter != Pe.end (); ++Pe_iter, ++Lf_iter, ++Le_iter)
-            dom_power (*Pe_iter, *Lf_iter, *Le_iter, *this);
+			dom_power (*Pe_iter, *Lf_iter, (long)*Le_iter, *this);
 
         Lf_iter = Lf.begin ();
         Le_iter = Le.begin ();
diff --git a/src/kernel/integer/integer.doxy b/src/kernel/integer/integer.doxy
new file mode 100644
index 0000000..e6836b6
--- /dev/null
+++ b/src/kernel/integer/integer.doxy
@@ -0,0 +1,7 @@
+/** @defgroup integer Integer
+  * @ingroup givaro
+  * @brief NO DOC
+  * NO DOC
+ */
+
+// vim:syntax=doxygen
diff --git a/src/kernel/memory/Makefile.am b/src/kernel/memory/Makefile.am
index e8c8f9f..502ce49 100644
--- a/src/kernel/memory/Makefile.am
+++ b/src/kernel/memory/Makefile.am
@@ -16,3 +16,5 @@ pkginclude_HEADERS= \
 noinst_LTLIBRARIES=libgivmemory.la
 
 libgivmemory_la_SOURCES=givaromm.C
+
+EXTRA_DIST=memory.doxy
diff --git a/src/kernel/memory/Makefile.in b/src/kernel/memory/Makefile.in
index 302fe0b..31d1d35 100644
--- a/src/kernel/memory/Makefile.in
+++ b/src/kernel/memory/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivmemory_la_LIBADD =
 am_libgivmemory_la_OBJECTS = givaromm.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivmemory_la_SOURCES)
 DIST_SOURCES = $(libgivmemory_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -222,6 +268,7 @@ pkginclude_HEADERS = \
 
 noinst_LTLIBRARIES = libgivmemory.la
 libgivmemory_la_SOURCES = givaromm.C
+EXTRA_DIST = memory.doxy
 all: all-am
 
 .SUFFIXES:
@@ -235,9 +282,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/memory/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/memory/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/memory/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/memory/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,6 +302,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -264,7 +312,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivmemory.la: $(libgivmemory_la_OBJECTS) $(libgivmemory_la_DEPENDENCIES) 
+libgivmemory.la: $(libgivmemory_la_OBJECTS) $(libgivmemory_la_DEPENDENCIES) $(EXTRA_libgivmemory_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivmemory_la_OBJECTS) $(libgivmemory_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -289,21 +337,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -317,7 +369,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -325,29 +377,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -368,13 +425,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -395,16 +456,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -494,6 +561,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/memory/givaromm.C b/src/kernel/memory/givaromm.C
index a3f4c9e..f1d8d58 100644
--- a/src/kernel/memory/givaromm.C
+++ b/src/kernel/memory/givaromm.C
@@ -182,7 +182,7 @@ void* GivMMFreeList::reallocate (void* src, const size_t oldsize, const size_t n
 {
 	if (src ==0) return _allocate(newsize) ;
 	if (newsize <= oldsize) return src;
-	BlocFreeList* tmp = (BlocFreeList*)(((char*)src)-sizeof(BlocFreeList)+sizeof(long));
+	BlocFreeList* tmp = reinterpret_cast<BlocFreeList*>(((char*)src)-sizeof(BlocFreeList)+sizeof(long));
 #ifdef GIVARO_DEBUG
 	if ((tmp->u.index <0) || (tmp->u.index >= BlocFreeList::lenTables))
 		throw GivError("[GivMMFreeList::reallocate]: bad pointer 'src'");
@@ -199,8 +199,8 @@ void* GivMMFreeList::reallocate (void* src, const size_t oldsize, const size_t n
 
 void GivMMFreeList::memcpy( void* dest, const void* src, const size_t size )
 {
-	BlocFreeList* tmp1 = (BlocFreeList*)(((char*)dest) - sizeof(BlocFreeList)+sizeof(long));
-	BlocFreeList* tmp2 = (BlocFreeList*)(((char*)src) - sizeof(BlocFreeList)+sizeof(long));
+	BlocFreeList* tmp1 = reinterpret_cast<BlocFreeList*>(((char*)dest) - sizeof(BlocFreeList)+sizeof(long));
+	BlocFreeList* tmp2 = reinterpret_cast<BlocFreeList*>(((char*)src) - sizeof(BlocFreeList)+sizeof(long));
 #ifdef GIVARO_DEBUG
 	if ((tmp1->u.index <0) || (tmp1->u.index >= BlocFreeList::lenTables))
 		throw GivError("[GivMMFreeList::memcpy]: bad pointer 'dest'");
@@ -230,7 +230,7 @@ void* GivMMRefCount::reallocate (void* p, const size_t oldsize, const size_t new
 		return &(GivMMFreeList::_allocate(newsize+sizeof(long))->data[1]) ;
 
 
-	BlocFreeList* tmp = (BlocFreeList*)(((char*)p)-sizeof(BlocFreeList));
+	BlocFreeList* tmp = reinterpret_cast<BlocFreeList*>(((char*)p)-sizeof(BlocFreeList));
 #ifdef GIVARO_DEBUG
 	if ((tmp->u.index <0) || (tmp->u.index >= BlocFreeList::lenTables))
 		throw GivError("[GivMMRefCount::reallocate]: bad pointer");
diff --git a/src/kernel/memory/givaromm.h b/src/kernel/memory/givaromm.h
index 7a64fa2..0631064 100644
--- a/src/kernel/memory/givaromm.h
+++ b/src/kernel/memory/givaromm.h
@@ -8,10 +8,16 @@
 // Author: T. Gautier
 // $Id: givaromm.h,v 1.7 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// - two memory managers: the first one handle a set on free-list
-//   of blocs, the second one implement a reference mecanism on
-//   the bloc. The latter used method of the former.
+
+/** @file givaromm.h
+ * @ingroup memory
+ * @brief Memory management in Givaro
+ * two memory managers:
+ * - the first one handle a set on free-list of blocs ;
+ * - the second one implement a reference mecanism on the bloc.
+ * .
+ * The latter used method of the former.
+ */
 #ifndef __GIVARO_mm_H
 #define __GIVARO_mm_H
 
@@ -29,7 +35,7 @@ namespace Givaro {
 
 // ==================================================================== //
 
-// -------- Static informations of memory allocation
+//!  Static informations of memory allocation
 class GivMMInfo {
 public:
 	GivMMInfo();
@@ -43,12 +49,13 @@ public:
 	std::ostream& print( std::ostream& so ) const;
 };
 
+//! IO
 inline std::ostream& operator<<( std::ostream& o, const GivMMInfo& T)
 { return T.print(o); }
 
 // --------------------------------------------------------
-// -- Data structure of a bloc.
-// Each bloc in TabFree[id] has a data field of size TabSize[id]
+//! Data structure of a bloc.
+//! Each bloc in TabFree[id] has a data field of size TabSize[id]
 class BlocFreeList {
 	union header {
 		int index ;             // - index in free list
@@ -69,8 +76,8 @@ class BlocFreeList {
 
 
 // --------------------------------------------------------
-// Implementation of a memory manager with free-lists.
-// All members are static methods.
+//! Implementation of a memory manager with free-lists.
+//! All members are static methods.
 class GivMMFreeList {
 public:
 
@@ -111,7 +118,7 @@ public:
 	inline static void desallocate(void* p, const size_t = 0)
 	{
 		if (p==0) return ;
-		BlocFreeList* tmp = (BlocFreeList*)(((char*)p) -
+		BlocFreeList* tmp = reinterpret_cast<BlocFreeList*>(((char*)p) -
 						    (sizeof(BlocFreeList)-sizeof(long)));
 		int index = tmp->u.index;
 #ifdef GIVARO_DEBUG
@@ -151,9 +158,9 @@ private:
 };
 
 
-// -- Memory management with reference counter on allocated data.
-// The memory manager uses the BlocFreeList data structure
-// and stores the refcounter in the field data[0]
+//! Memory management with reference counter on allocated data.
+//! The memory manager uses the BlocFreeList data structure
+//! and stores the refcounter in the field data[0]
 class GivMMRefCount {
 public:
 	// -- Allocation of a new bloc of size at least s
@@ -190,7 +197,7 @@ public:
 	inline static void desallocate(void* p, const size_t = 0)
 	{
 		if (p==0) return ;
-		BlocFreeList* tmp = (BlocFreeList*)(((char*)p) - sizeof(BlocFreeList));
+		BlocFreeList* tmp = reinterpret_cast<BlocFreeList*>((char *) p - sizeof(BlocFreeList) ) ;
 		if ( --(tmp->data[0]) ==0) {
 			int index = tmp->u.index;
 #ifdef GIVARO_DEBUG
@@ -216,7 +223,7 @@ public:
 		if (src == *dest) return *dest ;
 		if (*dest !=0) GivMMRefCount::desallocate( *dest );
 		if (src ==0) return *dest=src;
-		BlocFreeList* s = (BlocFreeList*)(((char*)src) - sizeof(BlocFreeList));
+		BlocFreeList* s = reinterpret_cast<BlocFreeList*>(((char*)src) - sizeof(BlocFreeList));
 #ifdef GIVARO_DEBUG
 		if ((s->u.index <0) || (s->u.index >= BlocFreeList::lenTables))
 			GivError::throw_error(GivError("[GivMMRefCount::assign]: bad pointer 'src'."));
@@ -230,7 +237,7 @@ public:
 	inline static int incrc(void* p)
 	{
 		if (p ==0) return 0;
-		BlocFreeList* bp = (BlocFreeList*)(((char*)p) - sizeof(BlocFreeList));
+		BlocFreeList* bp = reinterpret_cast<BlocFreeList*>(((char*)p) - sizeof(BlocFreeList));
 #ifdef GIVARO_DEBUG
 		if ((bp->u.index <0) || (bp->u.index >= BlocFreeList::lenTables))
 			throw GivError("[GivMMRefCount::incrc]: bad pointer.");
@@ -240,7 +247,7 @@ public:
 	inline static int decrc(void* p)
 	{
 		if (p ==0) return 0;
-		BlocFreeList* bp = (BlocFreeList*)(((char*)p) - sizeof(BlocFreeList));
+		BlocFreeList* bp = reinterpret_cast<BlocFreeList*>(((char*)p) - sizeof(BlocFreeList));
 #ifdef GIVARO_DEBUG
 		if ((bp->u.index <0) || (bp->u.index >= BlocFreeList::lenTables))
 			throw GivError("[GivMMRefCount::incrc]: bad pointer.");
@@ -250,7 +257,7 @@ public:
 	inline static int getrc(void* p)
 	{
 		if (p ==0) return 0;
-		BlocFreeList* bp = (BlocFreeList*)(((char*)p) - sizeof(BlocFreeList));
+		BlocFreeList* bp = reinterpret_cast<BlocFreeList*>(((char*)p) - sizeof(BlocFreeList));
 #ifdef GIVARO_DEBUG
 		if ((bp->u.index <0) || (bp->u.index >= BlocFreeList::lenTables))
 			throw GivError("[GivMMRefCount::incrc]: bad pointer.");
@@ -260,7 +267,7 @@ public:
 };
 
 
-// -- Memory manager that allocates array of object of type T for
+//! Memory manager that allocates array of object of type T for
 template<class T>
 class GivaroMM {
 public:
@@ -275,6 +282,10 @@ public:
 	// -- Call destructor on each elements pointed by bloc
 	static void destroy(T* bloc, const size_t s);
 };
+
+
+//! @bug implem does not belong here
+//@{
 template<class T>
 inline T* GivaroMM<T>::allocate (const size_t s)
 { return (T*)GivMMFreeList::allocate(s*sizeof(T)); }
@@ -290,6 +301,7 @@ inline void GivaroMM<T>::initialize(T* bloc, const size_t s, const T& V)
 template<class T>
 inline void GivaroMM<T>::destroy(T* bloc, const size_t s)
 { for (size_t i=0; i<s; i++) bloc[i].~T(); }
+//@}
 
 // -- specialized version: for basic C++ type and pointer on this type
 #define GIVARO_MM_SPECIALIZED(TYPE) \
diff --git a/src/kernel/memory/givpointer.h b/src/kernel/memory/givpointer.h
index 524fa63..b74dc78 100644
--- a/src/kernel/memory/givpointer.h
+++ b/src/kernel/memory/givpointer.h
@@ -8,8 +8,10 @@
 // Author: T. Gautier
 // $Id: givpointer.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// - auto ptr management
+/*! @file givpointer.h
+ * @ingroup memory
+ * @brief  auto ptr management
+ */
 #ifndef __GIVARO_pointer_H
 #define __GIVARO_pointer_H
 
@@ -19,6 +21,7 @@ namespace Givaro {
 
 // ==================================================================== //
 
+//! Refcount Pointer
 template<class T>
 class RefCountPtr {
   T*   _data;
diff --git a/src/kernel/memory/givref_count.h b/src/kernel/memory/givref_count.h
index 4b5c82c..06b6738 100644
--- a/src/kernel/memory/givref_count.h
+++ b/src/kernel/memory/givref_count.h
@@ -7,16 +7,21 @@
 // author: Th. Gautier
 // version : 2.7
 // date: 1995
-// Definition of the Counter class, Counter
-// This class definition objects to handle reference
-// counter for memory allocation (eg array0).
 // ==================================================================== //
+ /** @file givref_count.h
+  * @ingroup memory
+  * @brief Definition of the Counter class, Counter.
+ * This class definition objects to handle reference
+ * counter for memory allocation (eg array0).
+ */
+
 #ifndef __GIVARO_ref_counter_H
 #define __GIVARO_ref_counter_H
 #include <stddef.h>
 
 namespace Givaro {
 
+	//! Ref counter.
 class RefCounter {
 public:
    // Cstor and Dstor
diff --git a/src/kernel/memory/memory.doxy b/src/kernel/memory/memory.doxy
new file mode 100644
index 0000000..e7d9960
--- /dev/null
+++ b/src/kernel/memory/memory.doxy
@@ -0,0 +1,6 @@
+/** @defgroup memory Memory
+ * @ingroup givaro
+ * @brief NO DOC
+ */
+
+// vim:syn=doxygen
diff --git a/src/kernel/rational/Makefile.am b/src/kernel/rational/Makefile.am
index 29a8ab8..e31bfa4 100644
--- a/src/kernel/rational/Makefile.am
+++ b/src/kernel/rational/Makefile.am
@@ -24,3 +24,5 @@ libgivrational_la_SOURCES= \
 	givratcpy.C	           \
 	givratcompare.C        \
 	givratreconstruct.C
+
+EXTRA_DIST=rational.doxy
diff --git a/src/kernel/rational/Makefile.in b/src/kernel/rational/Makefile.in
index 812243d..44b5239 100644
--- a/src/kernel/rational/Makefile.in
+++ b/src/kernel/rational/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivrational_la_LIBADD =
 am_libgivrational_la_OBJECTS = givratcstor.lo givratio.lo \
@@ -79,14 +98,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivrational_la_SOURCES)
 DIST_SOURCES = $(libgivrational_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -120,6 +164,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -155,6 +200,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -235,6 +281,7 @@ libgivrational_la_SOURCES = \
 	givratcompare.C        \
 	givratreconstruct.C
 
+EXTRA_DIST = rational.doxy
 all: all-am
 
 .SUFFIXES:
@@ -248,9 +295,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/rational/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/rational/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/rational/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/rational/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -268,6 +315,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -277,7 +325,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivrational.la: $(libgivrational_la_OBJECTS) $(libgivrational_la_DEPENDENCIES) 
+libgivrational.la: $(libgivrational_la_OBJECTS) $(libgivrational_la_DEPENDENCIES) $(EXTRA_libgivrational_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivrational_la_OBJECTS) $(libgivrational_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -302,21 +350,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -330,7 +382,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -338,29 +390,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -381,13 +438,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -408,16 +469,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -507,6 +574,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/rational/givratcstor.C b/src/kernel/rational/givratcstor.C
index 17b776c..c23d4f7 100644
--- a/src/kernel/rational/givratcstor.C
+++ b/src/kernel/rational/givratcstor.C
@@ -226,4 +226,9 @@ void Rational::Init(int* , char***)
 void Rational::End()
 {}
 
+const Rational Rational::one (1UL) ;
+const Rational Rational::mOne(-1L) ;
+const Rational Rational::zero(0UL) ;
 } // namespace Givaro
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/rational/givrational.h b/src/kernel/rational/givrational.h
index 359c2f4..b47dfe9 100644
--- a/src/kernel/rational/givrational.h
+++ b/src/kernel/rational/givrational.h
@@ -8,8 +8,14 @@
 // Authors: M. Samama, T. Gautier
 // $Id: givrational.h,v 1.13 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
+/*! @file givrational.h
+ * @ingroup rational
+ * @brief Rationals (and domain)
+ * NO DOC.
+ */
 #ifndef __GIVARO_rational_H
 #define __GIVARO_rational_H
+// #define __GIVARO_GMPplusplus_rational_H
 
 #include "givaro/givinteger.h"
 #include "givaro/givmodule.h"
@@ -37,8 +43,8 @@ int isInteger(const Rational& r);
 
 class RationalDom;
 
-// ----------------------------------- Class Rational
 
+//! Rationals. No doc.
 class Rational {
 
 public :
@@ -54,6 +60,12 @@ public :
     Rational(const Integer& n) ;
     Rational(const Integer& n, const Integer& d, int red = 1 ) ;
         // Rational number reconstruction
+	/*! @brief Rational number reconstruction.
+	 * \f$ num/den \equiv f \mod m\f$, with \f$|num|<k\f$ and \f$0 < |den| \leq f/kf\f$
+	 * @bib
+	 * - von zur Gathen & Gerhard <i>Modern Computer Algebra</i>, 5.10, Cambridge Univ. Press 1999]
+	 */
+
     Rational(const Integer& f, const Integer& m, const Integer& k, bool recurs = false ) ;
     Rational(const Rational&) ;
         //~Rational();
@@ -61,6 +73,7 @@ public :
         // Predefined cstes
     static const Rational zero ;
     static const Rational one ;
+    static const Rational mOne ;
 
         // Logical and physical copies
     Rational& operator = (const Rational& );
@@ -75,8 +88,8 @@ public :
 //----------------Elementary arithmetic between Rational
     Rational operator + (const Rational& r) const ;
     Rational operator - (const Rational& r) const ;
-    Rational operator -() const ;
-    Rational operator +() const ;
+    Rational operator - () const ;
+    Rational operator + () const ;
     Rational operator * (const Rational& r) const ;
     Rational operator / (const Rational &r) const ;
     Rational& operator += (const Rational& r) ;
@@ -84,6 +97,8 @@ public :
     Rational& operator *= (const Rational& r) ;
     Rational& operator /= (const Rational &r) ;
 
+    Integer operator % (const Integer &r) const;
+
 //-----------------------------------------Arithmetic functions
     friend const Rational pow(const Rational &r, const long l);
 
@@ -164,24 +179,29 @@ public:
 }; // ----------------------------------- End of Class Rationalional
 
 extern std::istream& operator>> (std::istream& in, Rational& r) ;
+}
+
 
 #include "givaro/givrational.inl"
 
-//------------------------------------------------------ Class RationalDom
+namespace Givaro {
+
+//! Rational Domain
 class RationalDom  {
 public:
     typedef Rational Element;
     typedef Rational Rep;
 
         // -- Cstor
-    RationalDom() : one(1), zero(0) {}
-    template<class X> RationalDom(const X& x) : one(1), zero(0) {}
+    RationalDom() : one(1), mOne(-one), zero(0) {}
+    template<class X> RationalDom(const X& x) : one(1), mOne(-one),zero(0) {}
 
     int operator==( const RationalDom& ) const { return 1;}
     int operator!=( const RationalDom& ) const { return 0;}
 
         // -- Constants
     const Rational one;
+    const Rational mOne;
     const Rational zero;
 
     unsigned long characteristic() const { return 0UL; }
@@ -266,3 +286,5 @@ public:
 } //namespace Givaro
 
 #endif // __GIVARO_rational_H
+
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/src/kernel/rational/givrational.inl b/src/kernel/rational/givrational.inl
index d0a0763..ff0ba82 100644
--- a/src/kernel/rational/givrational.inl
+++ b/src/kernel/rational/givrational.inl
@@ -13,6 +13,8 @@
 #ifndef __GIVARO_rational_INL
 #define __GIVARO_rational_INL
 
+namespace Givaro {
+
 //-------------------------------------------------inline comparaison operators
 inline int operator != (const Rational& a , const Rational& b)
   { return compare(a,b) != 0 ; }
@@ -85,5 +87,6 @@ inline Rational Rational::reduce( const Rational& R) const
 //-------------------------------------------------inline >> & << operators
 inline std::ostream& operator<< (std::ostream& o, const Rational& a)
   { return a.print(o); }
+} // Givaro
 
 #endif // __GIVARO_rational_INL
diff --git a/src/kernel/rational/givratmuldiv.C b/src/kernel/rational/givratmuldiv.C
index 64cfb71..e1e2add 100644
--- a/src/kernel/rational/givratmuldiv.C
+++ b/src/kernel/rational/givratmuldiv.C
@@ -176,4 +176,17 @@ Rational& Rational::operator /= (const Rational& r)
 }
 
 
+// --------------------------------------- operator /=
+Integer Rational::operator % (const Integer& r) const
+{
+  if ( isZero(r) ) {
+     throw GivMathDivZero("*** division by zero, in operator / (const Rational&)") ;
+  }
+  if (isZero(this->num)) return this->num ;
+
+  Integer res(this->den);
+  invin(res, r);
+  return res *= this->num;
+}
+
 } // namespace Givaro
diff --git a/src/kernel/rational/givratreconstruct.C b/src/kernel/rational/givratreconstruct.C
index a00e731..a55eca0 100644
--- a/src/kernel/rational/givratreconstruct.C
+++ b/src/kernel/rational/givratreconstruct.C
@@ -16,10 +16,6 @@
 namespace Givaro {
 
 
-	/*! @brief Rational number reconstruction.
-	 * \f$ num/den \equiv f \mod m\f$, with \f$|num|<k\f$ and \f$0 < |den| \leq f/kf\f$
-	 * @bib See [von zur Gathen & Gerhard, Modern Computer Algebra, 5.10, Cambridge Univ. Press 1999]
-	 */
 	Rational::Rational(const Integer& f, const Integer& m, const Integer& k, bool recurs )
 	{
 		bool res = this->ratrecon(f,m,k,recurs);
diff --git a/src/kernel/rational/rational.doxy b/src/kernel/rational/rational.doxy
new file mode 100644
index 0000000..903695e
--- /dev/null
+++ b/src/kernel/rational/rational.doxy
@@ -0,0 +1,6 @@
+/** @defgroup rational Rationals
+ * @ingroup givaro
+ * @brief NO DOC
+*/
+
+// vim:syn=doxygen
diff --git a/src/kernel/system/Makefile.am b/src/kernel/system/Makefile.am
index 086b885..b550871 100644
--- a/src/kernel/system/Makefile.am
+++ b/src/kernel/system/Makefile.am
@@ -15,6 +15,7 @@ pkginclude_HEADERS= \
 	giverror.h	    \
 	givgenarith.h	\
 	givinit.h	    \
+	givcaster.h	    \
 	givmodule.h	    \
 	givperf.h 	    \
 	givpower.h	    \
@@ -29,3 +30,5 @@ libgivsystem_la_SOURCES= \
 	givinit.C	         \
 	givmodule.C	         \
 	givtimer.C
+
+EXTRA_DIST=system.doxy
diff --git a/src/kernel/system/Makefile.in b/src/kernel/system/Makefile.in
index a064241..435fc2d 100644
--- a/src/kernel/system/Makefile.in
+++ b/src/kernel/system/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivsystem_la_LIBADD =
 am_libgivsystem_la_OBJECTS = givbasictype.lo giverror.lo givinit.lo \
@@ -78,14 +97,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivsystem_la_SOURCES)
 DIST_SOURCES = $(libgivsystem_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -119,6 +163,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -154,6 +199,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -222,6 +268,7 @@ pkginclude_HEADERS = \
 	giverror.h	    \
 	givgenarith.h	\
 	givinit.h	    \
+	givcaster.h	    \
 	givmodule.h	    \
 	givperf.h 	    \
 	givpower.h	    \
@@ -236,6 +283,7 @@ libgivsystem_la_SOURCES = \
 	givmodule.C	         \
 	givtimer.C
 
+EXTRA_DIST = system.doxy
 all: all-am
 
 .SUFFIXES:
@@ -249,9 +297,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/system/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/system/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/system/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/system/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -269,6 +317,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -278,7 +327,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivsystem.la: $(libgivsystem_la_OBJECTS) $(libgivsystem_la_DEPENDENCIES) 
+libgivsystem.la: $(libgivsystem_la_OBJECTS) $(libgivsystem_la_DEPENDENCIES) $(EXTRA_libgivsystem_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivsystem_la_OBJECTS) $(libgivsystem_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -303,21 +352,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -331,7 +384,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -339,29 +392,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -382,13 +440,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -409,16 +471,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -508,6 +576,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/system/givbasictype.h b/src/kernel/system/givbasictype.h
index a5fb43e..a77c8c0 100644
--- a/src/kernel/system/givbasictype.h
+++ b/src/kernel/system/givbasictype.h
@@ -8,6 +8,12 @@
 // Authors: T. Gautier
 // $Id: givbasictype.h,v 1.4 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
+
+/** @file givbasictype.h
+ * @ingroup system
+ * @brief NO DOC
+ */
+
 #ifndef __GIVARO_basictype_H
 #define __GIVARO_basictype_H
 #include "givaro/givconfig.h"
@@ -18,7 +24,9 @@
 
 namespace Givaro {
 
-	// -- Neutral type: definition of zero and one
+	/** Neutral type.
+	 * definition of zero and one
+	 */
 	class Neutral {
 		public:
 			static Neutral zero;
@@ -31,13 +39,14 @@ namespace Givaro {
 			int _val;
 	};
 
-	// -- Used to build no initialized object as static object
+	//! Used to build no initialized object as static object
 	class givNoInit {};
-	// -- Used to call cstor without copy
+	//! Used to call cstor without copy
 	class givNoCopy {};
-	// -- Used to call cstor with copy
+	//! Used to call cstor with copy
 	class givWithCopy {};
 
 } // namespace Givaro
 
 #endif // __GIVARO_basictype_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givcaster.h b/src/kernel/system/givcaster.h
new file mode 100644
index 0000000..7aac787
--- /dev/null
+++ b/src/kernel/system/givcaster.h
@@ -0,0 +1,27 @@
+// ==========================================================================
+// Copyright(c)'2012 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// file: givcaster.h
+// Time-stamp: <21 May 12 15:35:16 Jean-Guillaume.Dumas at imag.fr>
+// ==========================================================================
+
+/** @file givcaster.h
+ * @ingroup system
+ * @brief NO DOC
+ */
+
+#ifndef __GIVARO_givcaster_H
+#define __GIVARO_givcaster_H
+
+namespace Givaro {
+    template <typename Target, typename Source>
+    Target& Caster (Target& t, const Source& s) {
+        return t = static_cast<Target>(s);
+    }
+}
+
+#endif // __GIVARO_caster_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givconfig.h b/src/kernel/system/givconfig.h
index c21078e..1b0b9e5 100644
--- a/src/kernel/system/givconfig.h
+++ b/src/kernel/system/givconfig.h
@@ -8,7 +8,10 @@
 // Authors: T. Gautier
 // $Id: givconfig.h,v 1.22 2011-02-04 14:50:07 bboyer Exp $
 // ==========================================================================
-// Description: configuration file for Givaro
+/** @file givconfig.h
+ * @ingroup system
+ * @brief configuration file for Givaro
+ */
 #ifndef _GIVARO_INTERNAL_CONFIG_H_
 #define _GIVARO_INTERNAL_CONFIG_H_ 1
 
@@ -62,9 +65,9 @@
 // - yy: minor version number
 // - zz: revision number
 #define GIVARO_MAJOR_VERSION    3
-#define GIVARO_MINOR_VERSION    4
-#define GIVARO_REVISION_VERSION 2
-#define GIVARO_VERSION          30402
+#define GIVARO_MINOR_VERSION    7
+#define GIVARO_REVISION_VERSION 0
+#define GIVARO_VERSION          30700
 
 // -- Defines this value both to compile the library of user program
 // value: integer that defines debug level trace information (not well defined)
@@ -77,52 +80,54 @@
 // -- Defines the basic integer arithmetics available on this machine
 #include <givaro-config.h>
 #ifdef __GIVARO_HAVE_STDINT_H
+#ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
+#endif
 #include <stdint.h>
 #ifndef INT64_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define INT64_MAX std::numeric_limits<int64_t>::max()
 #endif
 
 #ifndef UINT64_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define UINT64_MAX std::numeric_limits<uint64_t>::max()
 #endif
 
 #ifndef INT32_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define INT32_MAX std::numeric_limits<int32_t>::max()
 #endif
 
 #ifndef UINT32_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define UINT32_MAX std::numeric_limits<uint32_t>::max()
 #endif
 
 #ifndef INT16_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define INT16_MAX std::numeric_limits<int16_t>::max()
 #endif
 
 #ifndef UINT16_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define UINT16_MAX std::numeric_limits<uint16_t>::max()
 #endif
 
 #ifndef INT8_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define INT8_MAX std::numeric_limits<int8_t>::max()
 #endif
 
 #ifndef UINT8_MAX
-#warning "somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
+#pragma message "#warning somebody nasty previously included <stdint.h> without __STDC_LIMIT_MACROS :)"
 #include <limits>
 #define UINT8_MAX std::numeric_limits<uint8_t>::max()
 #endif
@@ -136,6 +141,7 @@
 # define GIVARO_BITS_PER_SHORTINT	SIZEOF_SHORT
 # define GIVARO_BITS_PER_CHAR		SIZEOF_CHAR
 
+#if 0 /*  standard types should be used */
 #ifndef __GIVARO_HAVE_STDINT_H
 typedef signed    __GIVARO_INT8      int8_t;
 typedef signed    __GIVARO_INT16     int16_t;
@@ -153,6 +159,7 @@ typedef unsigned  __GIVARO_INT64     uint64_t;
 #   define GIVARO_DONOTUSE_SIXTYFOUR 1
 # endif
 #endif
+#endif
 
 
 
@@ -312,7 +319,7 @@ template<class XXX> struct GIVARO_numeric_limits {
 #  endif
 #endif
 
-
+//! @bug why not use numeric limits from stl ?
 template<> inline float GIVARO_numeric_limits<float>::max() { return FLT_MAX; }
 template<> inline double GIVARO_numeric_limits<double>::max() { return DBL_MAX; }
 template<> inline short GIVARO_numeric_limits<short>::max() { return SHRT_MAX; }
@@ -402,3 +409,4 @@ template<> struct Signed_Trait<unsigned long>  : public GIVARO_numeric_limits<un
   #endif
 
 #endif
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/giverror.h b/src/kernel/system/giverror.h
index bbd4ee2..cf57e00 100644
--- a/src/kernel/system/giverror.h
+++ b/src/kernel/system/giverror.h
@@ -9,7 +9,7 @@
 // $Id: giverror.h,v 1.4 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*! @file system/giverror.h
+/*! @file giverror.h
  * @ingroup system
  * @brief error exception.
  */
@@ -20,7 +20,7 @@
 #include <iostream>
 namespace Givaro {
 // ------------------------------- GivError
-// - Base class for exeception handling in Givaro
+//! Base class for exeception handling in Givaro
 class GivError {
 public:
   GivError(const char* msg =0 )
@@ -40,6 +40,7 @@ protected:
   const char* strg;
 };
 
+//! Math error.
 class GivMathError : public GivError {
 public:
   virtual ~GivMathError() ;
@@ -47,13 +48,14 @@ public:
   GivMathError(const char* msg = 0) : GivError(msg) { }
 };
 
-// -- Exception thrown in input of data structure
+//! Exception thrown in input of data structure
 class GivBadFormat : public GivError {
 public:
   virtual ~GivBadFormat();
   GivBadFormat(const char* msg = 0) : GivError(msg) { }
 };
 
+//! Div by 0.
 class GivMathDivZero : public GivError {
 public:
   virtual ~GivMathDivZero();
@@ -63,3 +65,4 @@ public:
 } // namespace Givaro
 
 #endif // __GIVARO_error_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givgenarith.h b/src/kernel/system/givgenarith.h
index 8951e10..a5fff57 100644
--- a/src/kernel/system/givgenarith.h
+++ b/src/kernel/system/givgenarith.h
@@ -8,21 +8,23 @@
 // Authors: T. Gautier
 // $Id: givgenarith.h,v 1.5 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// Domain definition for basic type of the language.
+/** @file givgenarith.h
+ * @ingroup system
+ * @brief Domain definition for basic type of the language.
+ */
 #ifndef __GIVARO_genarith_H
 #define __GIVARO_genarith_H
 
 #include "givaro/givbasictype.h"
 namespace Givaro {
-// -- give a name for /read/write
+//! give a name for /read/write
 template<class T>
 struct __givdom_trait_name { enum { val = '?' }; };
 
 #define __GIVARO_SPEC_NAME( type, name ) \
 struct __givdom_trait_name<type> { enum { val = name }; } ;
 
-
+//! Base Domain
 template<class T>
 class BaseDomain {
 public:
@@ -93,20 +95,26 @@ public:
   { return s >> r; }
 };
 
-
+//! char dom
 typedef BaseDomain<char>    CharDom;
 __GIVARO_SPEC_NAME(char, 'c')
+//! short dom
 typedef BaseDomain<short>   ShortDom;
 __GIVARO_SPEC_NAME(short, 's')
+//! int dom
 typedef BaseDomain<int>     IntDom;
 __GIVARO_SPEC_NAME(int, 'i')
+//! long dom
 typedef BaseDomain<long>    LongDom;
 __GIVARO_SPEC_NAME(long, 'l')
+//! float dom
 typedef BaseDomain<float>   FloatDom;
 __GIVARO_SPEC_NAME(float, 'f')
+//! double dom
 typedef BaseDomain<double>  DoubleDom;
 __GIVARO_SPEC_NAME(double, 'd')
 
 } // namespace Givaro
 
 #endif // __GIVARO_genarith_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givinit.h b/src/kernel/system/givinit.h
index 8ecfc1d..84b0f03 100644
--- a/src/kernel/system/givinit.h
+++ b/src/kernel/system/givinit.h
@@ -8,21 +8,25 @@
 // Authors: T. Gautier
 // $Id: givinit.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
+/** @file givinit.h
+ * @ingroup system
+ * @brief NO DOC
+ */
 #ifndef __GIVARO_init_H
 #define __GIVARO_init_H
 #include "givaro/givconfig.h"
 #include <iostream>
 
+//! Namespace in which the whole Givaro library resides.
 namespace Givaro {
 
 // ==========================================================================
-// --
-// -- Description:
-//   - Initialisation of GIVARO :
-//     * handler to manage signal
-//     * init the memory manager
-//     * init all other modules
-
+	/**  Initialisation of GIVARO .
+	 * - handler to manage signal
+	 * - init the memory manager
+	 * - init all other modules
+	 * .
+	 */
 class GivaroMain {
 public:
   //- Init of Givaro kernel :
@@ -43,8 +47,8 @@ static void DisplayVersion();
 
 // ==========================================================================
 // --
-// -- Main application class
-// -- Could be not used
+//! Main application class
+//! Could be not used
 class GivaroAppli : public GivaroMain {
 public:
   //- Cstor, destor
@@ -60,3 +64,4 @@ public:
 
 } // namespace Givaro
 #endif // __GIVARO_init_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givmodule.h b/src/kernel/system/givmodule.h
index 125d566..75fbddc 100644
--- a/src/kernel/system/givmodule.h
+++ b/src/kernel/system/givmodule.h
@@ -8,6 +8,10 @@
 // Authors: T. Gautier
 // $Id: givmodule.h,v 1.4 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
+/** @file givmodule.h
+ * @ingroup system
+ * @brief NO DOC
+ */
 #ifndef __GIVARO_module_init_H
 #define __GIVARO_module_init_H
 
@@ -18,15 +22,16 @@ namespace Givaro {
 class GivModule;
 
 
-// ----------------------------------------------------------- GivaroNoInit:
-// Purpose: used to delay construction of object in the init function
-// of a module definition.
-
+//! GivaroNoInit.
+/**
+ * Purpose: used to delay construction of object in the init function
+ of a module definition.
+ */
 class GivaroNoInit {};
 
 
-// -------------------------------------------------------------- InitAfter:
-// Purpose: define a precedence relation between two modules.
+//! InitAfter.
+//! Purpose: define a precedence relation between two modules.
 
 class InitAfter {
 public:
@@ -43,9 +48,9 @@ private:
 };
 
 
-// -------------------------------------------------------------- GivModule:
-// Purpose: definition of module with precedence relation use to initialize
-// them between different units compilation.
+//! GivModule.
+//! Purpose: definition of module with precedence relation use to initialize
+//! them between different units compilation.
 
 class GivModule {
 public:
@@ -85,9 +90,9 @@ static void SortGivModule();
 };
 
 
-// -------------------------------------------------------------- GivModule:
-// Purpose: definition of object to be initialized after all modules
-// initialization
+//! GivModule.
+//! Purpose: definition of object to be initialized after all modules
+//! initialization
 
 class ObjectInit {
 public:
@@ -103,3 +108,4 @@ private:
 
 } // namespace Givaro
 #endif // __GIVARO_module_init_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givperf.h b/src/kernel/system/givperf.h
index d9dffb0..4b0dbce 100644
--- a/src/kernel/system/givperf.h
+++ b/src/kernel/system/givperf.h
@@ -8,8 +8,10 @@
 // Authors: T. Gautier
 // $Id: givperf.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// - performance analysis
+/** @file givperf.h
+ * @ingroup system
+ * @brief performance analysis
+ */
 #ifndef __GIVARO_perf_H
 #define __GIVARO_perf_H
 
@@ -19,6 +21,7 @@
 
 namespace Givaro {
 
+	//! cout counter
 struct __CoutCounter {
   void (*print)(ostream&);
   __CoutCounter( void (*prn)(ostream& ) ) : print(prn)
@@ -36,12 +39,13 @@ struct __CoutCounter {
 
 
 namespace Givaro {
-/*! @brief Class that store a set of counters.
+/*!@internal
+ * @brief Class that store a set of counters.
  * - _count_cstor: \#cstor calls except the recopy constructor calls
  * - _count_cstor_recopy: \#recopy cstor calls
  * - _count_assign: \#assignment calls
  * - _count_dstor: \#dstor calls
- * *
+ * .
  */
 
 #define GIVARO_PERF_DEFCLASS(Name,Type)					\
diff --git a/src/kernel/system/givpower.h b/src/kernel/system/givpower.h
index 5d16849..0b23b9d 100644
--- a/src/kernel/system/givpower.h
+++ b/src/kernel/system/givpower.h
@@ -8,15 +8,22 @@
 // Time-stamp: <25 Feb 11 13:34:07 Jean-Guillaume.Dumas at imag.fr>
 // ==========================================================================
 
+/** @file givpower.h
+ * @ingroup system
+ * @brief NO DOC
+ */
+
 #ifndef __GIVARO_power_H
 #define __GIVARO_power_H
 
 namespace Givaro {
 
 // -------------------------------------------------------------
-// Integer log
+//! Integer log
 // -------------------------------------------------------------
-template<typename T> inline unsigned GIVINTLOG(const T& a) {
+template<typename T>
+	inline unsigned GIVINTLOG(const T& a)
+{
     unsigned l(0);
     for(T v(a); v >>= 1; ++l) {}
     return l;
@@ -25,12 +32,14 @@ template<typename T> inline unsigned GIVINTLOG(const T& a) {
 
 
 // -------------------------------------------------------------
-// Powering
+//! Powering
 // -------------------------------------------------------------
-template<class TT, class UU> TT power(const TT n, const UU l) {
+template<class TT, class UU>
+TT power(const TT n, const UU l)
+{
   if (l == 0) return 1 ;
 
-  unsigned long p = l ;
+  unsigned long p = (unsigned long) l ;
   short is_assg = 0 ;
 
   TT res = TT(1) ;
@@ -51,18 +60,22 @@ template<class TT, class UU> TT power(const TT n, const UU l) {
   }
   return res ;
 }
-/*
+
+#if 0
 #include <givaro/givinteger.h>
 template<> Integer power(const Integer n, const long l) { return pow(n,l); }
 template<> Integer power(const Integer n, const unsigned long l) { return pow(n,l); }
 template<> Integer power(const Integer n, const int l) { return pow(n,l); }
 template<> Integer power(const Integer n, const unsigned int l) { return pow(n,l); }
-*/
+#endif
 
-template<class D, class TT> TT& dom_power(TT& res, const TT& n, long l, const D& F) {
+//! dom_power
+template<class D, class TT>
+TT& dom_power(TT& res, const TT& n, long l, const D& F)
+{
   if (l == 0) return res = F.one ;
 
-  unsigned long p = l ;
+  unsigned long p = (unsigned long) l ;
   short is_assg = 0 ;
 
   TT puiss = n ;
@@ -84,14 +97,15 @@ template<class D, class TT> TT& dom_power(TT& res, const TT& n, long l, const D&
 }
 
 
-/*
+#if 0
 #include <math.h>
 
 template<> double power<double>(const double a, const double e) {
    return pow(a,e);
 }
-*/
+#endif
 
 } // namespace Givaro
 
 #endif // __GIVARO_power_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/givrandom.h b/src/kernel/system/givrandom.h
index 4ea8cd6..f0a9b89 100644
--- a/src/kernel/system/givrandom.h
+++ b/src/kernel/system/givrandom.h
@@ -4,16 +4,16 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro : random generator
-// a la Linbox ...
 // Time-stamp: <13 Jul 07 14:40:27 Jean-Guillaume.Dumas at imag.fr>
 // =================================================================== //
 
-/*! @file system/givrandom.h
+/*! @file givrandom.h
  * @ingroup system
  * @brief NO DOC
- * @bib Fishman, G.S. "Multiplicative congruential random
- * number generators ..." Math. Comp. 54:331-344 (1990)
+ * @bib
+ *   - Fishman, GS <i>Multiplicative congruential random
+ * number generators...</i> Math. Comp. 54:331-344 (1990).
+ *
  */
 
 #ifndef __GIVARO_random_H
@@ -36,6 +36,7 @@ extern "C" {
 
 namespace Givaro {
 
+	//! GivRandom
 class GivRandom {
     mutable unsigned long _seed;
 public:
@@ -47,7 +48,7 @@ public:
         if (! s) {
 		struct timeval tp;
 		gettimeofday(&tp, 0) ;
-		_seed = (long)(tp.tv_usec);
+		_seed = (unsigned long)(tp.tv_usec);
 	}
     }
 
@@ -66,13 +67,14 @@ public:
 	    return _seed;
     }
 
-#if defined(__GIVARO_INT64)
+// #if defined(__GIVARO_INT64)
+#if 1
     unsigned long operator() () const
     {
         return _seed = (unsigned long)(
-            (__GIVARO_INT64)_GIVRAN_MULTIPLYER_
-            * (__GIVARO_INT64)_seed
-            % (__GIVARO_INT64)_GIVRAN_MODULO_ );
+            (int64_t)_GIVRAN_MULTIPLYER_
+            * (int64_t)_seed
+            % (int64_t)_GIVRAN_MODULO_ );
     }
 #else
     unsigned long operator() () const
diff --git a/src/kernel/system/givtimer.h b/src/kernel/system/givtimer.h
index e2605ce..010b7f0 100644
--- a/src/kernel/system/givtimer.h
+++ b/src/kernel/system/givtimer.h
@@ -17,6 +17,11 @@
  *
  */
 
+/** @file givtimer.h
+ * @ingroup system
+ * @brief timer
+ */
+
 #ifndef __GIVARO_timer_H
 #define __GIVARO_timer_H
 
@@ -27,7 +32,6 @@ namespace Givaro {
 /** \brief base for class RealTimer; class SysTimer; class UserTimer;
   \ingroup util
   */
-
 class BaseTimer {
 public:
 	enum {
@@ -66,11 +70,13 @@ public:
 	double _t;        // time
 };
 
+//! I/O
 inline std::ostream& operator<< (std::ostream& o, const BaseTimer& BT)
 {
 	return BT.print(o);
 }
 
+//! Real timer
 class RealTimer : public BaseTimer {
 public:
 	inline RealTimer( const BaseTimer& BT ): BaseTimer(BT) {};
@@ -86,6 +92,7 @@ public:
 };
 
 
+//! User timer
 class UserTimer : public BaseTimer {
 public:
 	inline UserTimer( const BaseTimer& BT ) : BaseTimer(BT) {};
@@ -100,7 +107,7 @@ public:
 
 };
 
-
+//! Sys timer
 class SysTimer : public BaseTimer {
 public:
 	inline SysTimer( const BaseTimer& BT ): BaseTimer(BT) {};
@@ -116,6 +123,7 @@ public:
 };
 
 
+//! Timer
 class Timer {
 public :
 
@@ -214,6 +222,7 @@ private:
 	SysTimer  st;
 };
 
+//! I/O
 inline std::ostream &operator << (std::ostream &o, const Timer &T)
 {
 	double ut = T.usertime();
@@ -223,6 +232,7 @@ inline std::ostream &operator << (std::ostream &o, const Timer &T)
 
 #if defined(_OPENMP) || defined(OMP_H) || defined(__OMP_H)
 #include <omp.h>
+//! OMP timer
 struct OMPTimer {
 	double _c;
 	void start() { _c = omp_get_wtime(); }
@@ -253,3 +263,4 @@ struct OMPTimer {
 } // namespace Givaro
 
 #endif // __GIVARO_timer_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/system/system.doxy b/src/kernel/system/system.doxy
new file mode 100644
index 0000000..5065afa
--- /dev/null
+++ b/src/kernel/system/system.doxy
@@ -0,0 +1,6 @@
+/** @defgroup system System
+ * @ingroup givaro
+ * @brief NO DOC
+*/
+
+// vim:syn=doxygen
diff --git a/src/kernel/zpz/Makefile.am b/src/kernel/zpz/Makefile.am
index 7e64c6b..bc0196e 100644
--- a/src/kernel/zpz/Makefile.am
+++ b/src/kernel/zpz/Makefile.am
@@ -18,6 +18,7 @@ pkginclude_HEADERS=     \
 	givzpz32std.h		\
 	givzpz32uns.h		\
 	givzpzInt.h		    \
+	givzpzGen.h		    \
 	givzpz64std.h		\
 	givprimes16.h		\
 	givrns.h		    \
@@ -34,6 +35,7 @@ pkginclude_HEADERS=     \
 	givzpz32std.inl		\
 	givzpz32uns.inl		\
 	givzpzInt.inl		\
+	givzpzGen.inl		\
 	givzpz64std.inl		\
 	givrnsfixed.inl		\
 	givrnscstor.inl		\
@@ -49,8 +51,9 @@ libgivzpz_la_SOURCES=   \
 	givzpz32std.C		\
 	givzpz32uns.C		\
 	givmontg32.C		\
-	givzpzInt.C		    \
 	givzpz64std.C		\
 	givprimes16.C		\
 	givtablelimits.C	\
 	givzpz16table1.C
+
+EXTRA_DIST=zpz.doxy
diff --git a/src/kernel/zpz/Makefile.in b/src/kernel/zpz/Makefile.in
index 9352398..308c613 100644
--- a/src/kernel/zpz/Makefile.in
+++ b/src/kernel/zpz/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,11 +77,12 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivzpz_la_LIBADD =
 am_libgivzpz_la_OBJECTS = givzpz16std.lo givzpz32std.lo givzpz32uns.lo \
-	givmontg32.lo givzpzInt.lo givzpz64std.lo givprimes16.lo \
-	givtablelimits.lo givzpz16table1.lo
+	givmontg32.lo givzpz64std.lo givprimes16.lo givtablelimits.lo \
+	givzpz16table1.lo
 libgivzpz_la_OBJECTS = $(am_libgivzpz_la_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
@@ -79,14 +98,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivzpz_la_SOURCES)
 DIST_SOURCES = $(libgivzpz_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -120,6 +164,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -155,6 +200,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -230,6 +276,7 @@ pkginclude_HEADERS = \
 	givzpz32std.h		\
 	givzpz32uns.h		\
 	givzpzInt.h		    \
+	givzpzGen.h		    \
 	givzpz64std.h		\
 	givprimes16.h		\
 	givrns.h		    \
@@ -246,6 +293,7 @@ pkginclude_HEADERS = \
 	givzpz32std.inl		\
 	givzpz32uns.inl		\
 	givzpzInt.inl		\
+	givzpzGen.inl		\
 	givzpz64std.inl		\
 	givrnsfixed.inl		\
 	givrnscstor.inl		\
@@ -260,12 +308,12 @@ libgivzpz_la_SOURCES = \
 	givzpz32std.C		\
 	givzpz32uns.C		\
 	givmontg32.C		\
-	givzpzInt.C		    \
 	givzpz64std.C		\
 	givprimes16.C		\
 	givtablelimits.C	\
 	givzpz16table1.C
 
+EXTRA_DIST = zpz.doxy
 all: all-am
 
 .SUFFIXES:
@@ -279,9 +327,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/kernel/zpz/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/kernel/zpz/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/kernel/zpz/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/kernel/zpz/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -299,6 +347,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -308,7 +357,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivzpz.la: $(libgivzpz_la_OBJECTS) $(libgivzpz_la_DEPENDENCIES) 
+libgivzpz.la: $(libgivzpz_la_OBJECTS) $(libgivzpz_la_DEPENDENCIES) $(EXTRA_libgivzpz_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivzpz_la_OBJECTS) $(libgivzpz_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -333,21 +382,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -361,7 +414,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -369,29 +422,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -412,13 +470,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -439,16 +501,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -538,6 +606,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/kernel/zpz/StaticElement.h b/src/kernel/zpz/StaticElement.h
index 4ddea72..3952fe0 100644
--- a/src/kernel/zpz/StaticElement.h
+++ b/src/kernel/zpz/StaticElement.h
@@ -11,7 +11,7 @@
 // date: 2004
 //==================================================================
 
-/*! @file zpz/taticElement.h
+/*! @file StaticElement.h
  * @ingroup zpz
  * @brief NO DOC
  */
@@ -24,6 +24,7 @@
 
 namespace Givaro {
 
+	//! Static Element
 template <class Domain>
 class StaticElement {
     static Domain _domain;
diff --git a/src/kernel/zpz/giv_randiter.h b/src/kernel/zpz/giv_randiter.h
index d35d42c..880cbb1 100644
--- a/src/kernel/zpz/giv_randiter.h
+++ b/src/kernel/zpz/giv_randiter.h
@@ -4,27 +4,32 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Givaro field Elements generator
 // Author : Giorgi Pascal   pascal.giorgi at ens-lyon.fr
 //==================================================================
 
+/** @file giv_randiter.h
+ * @ingroup zpz
+ * @brief NO DOC
+ * Givaro field Elements generator
+ */
+
 #ifndef __GIVARO_randiter_H
 #define __GIVARO_randiter_H
 
 
 #include "givaro/givinteger.h"
 #include "givaro/givrandom.h"
+#include "givaro/givzpztypes.h"
 
 namespace Givaro {
 
-template<class TAG>
-class ZpzDom ;
+template<class TAG> class ZpzDom ;
 
 // -- Tag for arithmetic:
-class Std16 /*{public: typedef  int16_t type;}*/ ; // -- standard arithmetic over 16bits representations.
-class Std32 /*{public: typedef int32_t type;}*/ ; // -- standard arithmetic over 32bits representations.
+struct Std16 /*{public: typedef  int16_t type;}*/ ; // -- standard arithmetic over 16bits representations.
+struct Std32 /*{public: typedef int32_t type;}*/ ; // -- standard arithmetic over 32bits representations.
 
-class Log16 ; // -- log arithmetic over 16bits representations.
+struct Log16 ; // -- log arithmetic over 16bits representations.
 
 template<> class ZpzDom<Std16>;
 template<> class ZpzDom<Std32>;
@@ -36,8 +41,8 @@ template<class TT> class GFqDom;
  *   throught a template argument as a field.
  *   The random generator used is the givrandom.
  */
-
-template <class Field , class Type> class GIV_randIter
+template <class Field , class Type>
+	class GIV_randIter
 {
   public:
 
@@ -151,9 +156,6 @@ template <class Field , class Type> class GIV_randIter
     //@} Common Object Iterface
 
     /** @name Implementation-Specific Methods.
-     * These methods are not required of all
-     * \Ref{LinBox Random field Element generators}
-     * and are included only for this implementation of the archetype.
      */
     //@{
 
diff --git a/src/kernel/zpz/givcra.h b/src/kernel/zpz/givcra.h
index c71f8d7..10bded2 100644
--- a/src/kernel/zpz/givcra.h
+++ b/src/kernel/zpz/givcra.h
@@ -9,7 +9,7 @@
 // $Id: givcra.h,v 1.12 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*!@file zpz/givcra.h
+/*!@file givcra.h
  * @ingroup zpz
  * @brief  Chinese Remainder Algorithm for 2 Elements.
  * @sa
@@ -24,6 +24,7 @@
 
 namespace Givaro {
 
+	//! CRA
 template<class Ring, class Domain, bool REDUCE = true>
 struct ChineseRemainder {
     typedef typename Ring::Element   RingElement;
@@ -60,8 +61,9 @@ private:
     RingElement C_12;
 };
 
-// JGD 05.12.2007: not required anymore ...
-//template<>
+//! CRA2.
+//! JGD 05.12.2007: not required anymore ...
+
 template<class Ring, class Domain>
 struct ChineseRemainder<Ring, Domain, false>  {
     typedef typename Ring::Element   RingElement;
diff --git a/src/kernel/zpz/givextension.h b/src/kernel/zpz/givextension.h
index e5fbcfd..14c8ee0 100644
--- a/src/kernel/zpz/givextension.h
+++ b/src/kernel/zpz/givextension.h
@@ -5,6 +5,7 @@
 // see the COPYRIGHT file for more details.
 
 /*! @file givextension.h
+ * @ingroup zpz
  * @brief NO DOX
  */
 
@@ -20,40 +21,58 @@
 
 namespace Givaro {
 
-template<class Rt> Rt FF_EXPONENT_MAX(const Rt p, const Rt e = 1) {
+	//! XXX
+    template<class Rt>
+	Rt FF_EXPONENT_MAX(const Rt p, const Rt maxe = _GIVARO_FF_MAXEXPONENT_)
+	{
 	Rt f = 0;
-	for(Rt i = p; (i < (Rt)FF_TABLE_MAX) && (f < e); ++f, i*=p)
-		;
+	for(Rt i = p; (i < (Rt)_GIVARO_FF_TABLE_MAX) && (f < maxe); ++f, i*=p) ;
+	return f;
+    }
+
+	//! XXX
+    template<class Rt>
+	Rt FF_SUBEXPONENT_MAX(const Rt p, const Rt e)
+	{
+	Rt f = FF_EXPONENT_MAX(p,e);
 	for( ; f > 1; --f)
-		if ((e % f) == 0) break;
+            if ((e % f) == 0) break;
 	return f;
-}
+    }
 
-#define NEED_POLYNOMIAL_REPRESENTATION(p,e) ((e) > FF_EXPONENT_MAX((p),(e)))
+#define NEED_POLYNOMIAL_REPRESENTATION(p,e) ((e) > FF_SUBEXPONENT_MAX((p),(e)))
 
 #define EXTENSION(q,expo) ( NEED_POLYNOMIAL_REPRESENTATION((q),(expo)) ? Extension<>((q), (expo)) : GFqDom<long>((q), (expo)) )
 
 
-template<typename Field> unsigned long Exponent_Trait(const Field& F) {
-    return 1;
-}
-
+	//! XXX
+    template<typename Field>
+	unsigned long Exponent_Trait(const Field& F)
+	{
+        return 1;
+    }
 
-template<> unsigned long Exponent_Trait(const GFqDom<long>& F) {
-    return F.exponent();
-}
 
-template<typename BaseField> class Extension;
+	//! XXX
+    template<>
+	inline unsigned long Exponent_Trait(const GFqDom<long>& F)
+	{
+        return F.exponent();
+    }
 
-template<typename BaseField>
-unsigned long Exponent_Trait(const Extension<BaseField>& F) {
-    return F.exponent();
-}
+    template<typename BaseField> class Extension;
 
+	//! XXX
+    template<typename BaseField>
+    unsigned long Exponent_Trait(const Extension<BaseField>& F)
+	{
+        return F.exponent();
+    }
 
-template<class BFT = GFqDom<long>  >
-class Extension {
-public:
+//! Extension
+    template<class BFT = GFqDom<long>  >
+    class Extension {
+    public:
 	typedef          Extension<BFT>                            Self_t;
 	typedef          BFT                                  BaseField_t;
 	typedef typename BFT::Element                           BFElement;
@@ -62,70 +81,97 @@ public:
 	typedef          Poly1FactorDom< BFT, Dense >               Pol_t;
 	typedef typename Pol_t::Element                        PolElement;
 
-protected:
+    protected:
 
 	BaseField_t           _bF;
 	Pol_t                 _pD;
 	PolElement         _irred;
 	Residu_t  _characteristic;
-	Residu_t        _exponent;
 	Residu_t _extension_order;
+	Residu_t        _exponent;
 	Integer      _cardinality;
 
-public:
+    public:
 
 	bool extension_type () const
-	{
+            {
 	       	return true;
-	}
+            }
 
 	typedef PolElement Element;
 
 	Element zero;
 	Element one;
+	Element mOne;
 
 	Extension() {}
 
 
 	Extension ( const Residu_t p, const Residu_t e = 1, const Indeter Y="Y") :
-		_bF(p, FF_EXPONENT_MAX(p,e) ), _pD( _bF, Y  ), _characteristic( p )
-		, _exponent ( e ) , _extension_order( e/FF_EXPONENT_MAX(p,e) )
-		, _cardinality( pow(Integer(p),(unsigned long)(e)) ), zero (_pD.zero)
-		, one (_pD.one)
-	{
-		/*     cerr << "Pol Cstor" << endl; */
-		unsigned long basedegree = FF_EXPONENT_MAX(p,e) ;
+		_bF(p, FF_SUBEXPONENT_MAX(p,e) ), _pD( _bF, Y  ), _characteristic( p )
+            , _extension_order( e/FF_SUBEXPONENT_MAX(p,e) ), _exponent ( e )
+            , _cardinality( pow(Integer(p),(unsigned long)(e)) ), zero (_pD.zero)
+            , one (_pD.one), mOne(_pD.mOne)
+            {
+                    /*     cerr << "Pol Cstor" << endl; */
+		unsigned long basedegree = FF_SUBEXPONENT_MAX(p,e) ;
 		if (basedegree >= e) {
-			std::cerr << "WARNING : Try a direct extension field GFDom instead of a polynomial extension" << std::endl;
-			_bF = BaseField_t(p, 1);
-			_pD = Pol_t(_bF, Y);
-			_extension_order = _exponent;
+                    std::cerr << "WARNING : Try a direct extension field GFDom instead of a polynomial extension" << std::endl;
+                    _bF = BaseField_t(p, 1);
+                    _pD = Pol_t(_bF, Y);
+                    _extension_order = _exponent;
 		}
-		_pD.creux_random_irreducible( _irred, _extension_order );
-	}
+		_pD.creux_random_irreducible( _irred, (long)_extension_order );
+            }
+
+
 
 	Extension ( const BaseField_t& bF, const Residu_t ex = 1, const Indeter Y="Y") :
 	       	_bF( bF )
-		, _pD( _bF, Y  )
-		, _characteristic(  (Residu_t) bF.characteristic() )
-		, _exponent(        (Residu_t)(ex + (Residu_t)Exponent_Trait(bF)) )
-		, _extension_order( (Residu_t)( ex ) )
-		, _cardinality(     (Integer) pow( Integer(bF.cardinality()) , (unsigned long)(ex) ) )
-		, zero(             (Element)(_pD.zero))
-		, one (             (Element)(_pD.one))
-	{
+            , _pD( _bF, Y  )
+            , _characteristic(  (Residu_t) bF.characteristic() )
+            , _extension_order( (Residu_t)( ex ) )
+            , _exponent(        (Residu_t)(ex + (Residu_t)Exponent_Trait(bF)) )
+            , _cardinality(     (Integer) pow( Integer(bF.cardinality()) , (unsigned long)(ex) ) )
+            , zero(             (Element)(_pD.zero))
+            , one (             (Element)(_pD.one))
+            , mOne (             (Element)(_pD.mOne))
+            {
+				Degree eo ((long int)_extension_order);
 		if (_cardinality < (1<<20) )
-			_pD.creux_random_irreducible( _irred, (unsigned long)(ex));
+                    _pD.creux_random_irreducible( _irred, eo);
 		else
-			_pD.random_irreducible( _irred, (unsigned long)(ex));
-	}
-
-	Extension ( const Self_t& eF) :
-	       	_bF( eF._bF ), _pD( eF._pD ), _irred( eF._irred )
-		, _characteristic( eF._characteristic ), _exponent( eF._exponent )
-		, _extension_order( eF._extension_order ), _cardinality( eF._cardinality )
-		, zero (_pD.zero), one (_pD.one)
-       	{ }
+                    _pD.random_irreducible( _irred,  eo);
+            }
+
+
+        Extension ( const Pol_t& polydomain, const PolElement& Irred) :
+                _bF( polydomain.getdomain() )
+            , _pD( polydomain )
+            , _irred( Irred )
+            , _characteristic(  (Residu_t) _bF.characteristic() )
+            , _extension_order( (Residu_t) _pD.degree(Irred).value() )
+            , _exponent(        (Residu_t)( _extension_order + (Residu_t)Exponent_Trait(_bF)) )
+            , _cardinality(     (Integer) pow( Integer(_bF.cardinality()) , (unsigned long)_extension_order ) )
+            , zero(             (Element)(_pD.zero))
+            , one (             (Element)(_pD.one))
+            , mOne (             (Element)(_pD.mOne))
+            {
+                if (polydomain.isOne(_irred)) {
+                    if (_cardinality < (1<<20) )
+                        _pD.creux_random_irreducible( _irred,  (long) _extension_order);
+                    else
+                        _pD.random_irreducible( _irred,  (long) _extension_order);
+                }
+            }
+
+        Extension ( const Self_t& eF) :
+                _bF( eF._bF ), _pD( eF._pD ), _irred( eF._irred )
+            , _characteristic( eF._characteristic )
+            , _extension_order( eF._extension_order )
+            , _exponent( eF._exponent ), _cardinality( eF._cardinality )
+            , zero (_pD.zero), one (_pD.one), mOne (_pD.mOne)
+            { }
 
 	Self_t & operator=(const Self_t& eF)
 	{
@@ -137,20 +183,23 @@ public:
 			_exponent = eF._exponent;
 			_extension_order = eF._extension_order;
 			_cardinality = eF._cardinality;
+			zero = eF.zero;
+			one = eF.one;
+			mOne = eF.mOne;
 		}
 		return *this;
 	}
 
 	PolElement& init( PolElement& e) const
-	{
+            {
 		return _pD.init(e) ;
-	}
+            }
 
 	template<class XXX>
 	PolElement& init( PolElement& e, const XXX& i) const
-	{
+            {
 		return _pD.modin( _pD.init(e, i), _irred) ;
-	}
+            }
 
 	PolElement& assign( PolElement& e, const BFElement& a) const
 	{
@@ -158,383 +207,393 @@ public:
 	}
 
 	PolElement& assign( PolElement& e, const PolElement& a) const
-	{
+            {
 		return _pD.assign(e, a) ;
-	}
+            }
 
 	template<class XXX>
 	XXX& convert( XXX& i, const PolElement& e) const
-	{
+            {
 		return _pD.convert( i, e) ;
-	}
+            }
 
 	PolElement& add (PolElement& r, const PolElement& a, const PolElement& b) const
-	{
+            {
 		return _pD.add( r, a, b);
-	}
+            }
 
 	PolElement& sub (PolElement& r, const PolElement& a, const PolElement& b) const
-	{
+            {
 		return _pD.sub( r, a, b);
-	}
+            }
 
 	PolElement& neg (PolElement& r, const PolElement& a) const
-	{
+            {
 		return _pD.neg( r, a );
-	}
+            }
 
 	PolElement& mul (PolElement& r, const PolElement& a, const PolElement& b) const
-	{
+            {
 		return _pD.modin( _pD.mul( r, a, b), _irred );
-	}
+            }
 
 	PolElement& inv (PolElement& r, const PolElement& a) const
-	{
-		//          _pD.write(_pD.write(_pD.write( std::cerr << "(", _pD.invmod( r, a, _irred)) << ") * (", a) << ")   == 1 + V * (", _irred) << std::endl;
+            {
+                    //          _pD.write(_pD.write(_pD.write( std::cerr << "(", _pD.invmod( r, a, _irred)) << ") * (", a) << ")   == 1 + V * (", _irred) << std::endl;
 		return  _pD.invmod( r, a, _irred);
-	}
+            }
 
 	PolElement& div (PolElement& r, const PolElement& a, const PolElement& b) const
-	{
+            {
 		return _pD.modin( _pD.mulin( inv(r, b), a), _irred );
-	}
+            }
 
 	PolElement& axpy (PolElement& r, const PolElement& a, const PolElement& b, const PolElement& c) const
-	{
-		//         return _pD.modin( _pD.addin(_pD.mul( r, a, b), c), _irred );
-		//          return _pD.modin( _pD.axpy(r, a, b, c), _irred );
+            {
+                    //         return _pD.modin( _pD.addin(_pD.mul( r, a, b), c), _irred );
+                    //          return _pD.modin( _pD.axpy(r, a, b, c), _irred );
 		return addin(mul(r,a,b),c);
-	}
+            }
 
-	// -- maxpy: r <- c - a * b mod p
+            // -- maxpy: r <- c - a * b mod p
 	PolElement& maxpy (PolElement& r, const PolElement a, const PolElement b, const PolElement c) const
-	{
+            {
 		return _pD.modin( _pD.maxpy( r, a, b, c), _irred );
-	}
+            }
 
-	// -- maxpyin: r <- r - a * b mod p
+            // -- maxpyin: r <- r - a * b mod p
 	PolElement& maxpyin(PolElement& r, const PolElement a, const PolElement b) const
-	{
+            {
 		return _pD.modin( _pD.maxpyin( r, a, b), _irred );
-	}
+            }
 
-	// -- axmy: r <- a * x - y mod p
+            // -- axmy: r <- a * x - y mod p
 	PolElement& axmy  (PolElement& r, const PolElement a, const PolElement b, const PolElement c) const
-	{
+            {
 		return subin(mul(r,a,b),c);
-	}
+            }
 
-	// -- axmyin: r <- a * x - r mod p
+            // -- axmyin: r <- a * x - r mod p
 	PolElement& axmyin(PolElement& r, const PolElement a, const PolElement b) const
-	{
+            {
 		maxpyin(r,a,b);
 		return negin(r);
-	}
+            }
 
 	PolElement& addin(PolElement& r, const PolElement& b) const
-	{
+            {
 		return _pD.addin( r, b);
-	}
+            }
 
 	PolElement& subin(PolElement& r, const PolElement& b) const
-	{
+            {
 		return _pD.subin( r, b);
-	}
+            }
 
 	PolElement& negin(PolElement& r) const
-	{
+            {
 		return _pD.negin( r );
-	}
+            }
 
 	PolElement& mulin(PolElement& r, const PolElement& b) const
-	{
+            {
 		return _pD.modin( _pD.mulin( r, b), _irred );
-	}
+            }
 
 	PolElement& invin(PolElement& r) const
-	{
+            {
 		PolElement a(r);
 		return _pD.invmod( r, a, _irred);
-	}
+            }
 
 	PolElement& divin(PolElement& r, const PolElement& b) const
-	{
+            {
 		PolElement tmp;
 		inv(tmp,b);
 		return _pD.modin( _pD.mulin( r, tmp), _irred );
-	}
+            }
 
 	PolElement& axpyin(PolElement& r, const PolElement& b, const PolElement& c) const
-	{
+            {
 		PolElement tmp; _pD.mul(tmp,b,c);
 		return _pD.modin( _pD.addin( r, tmp), _irred );
-	}
+            }
 
 	bool areEqual (const PolElement& b, const PolElement& c) const
-	{
+            {
 		return _pD.areEqual( b, c) ;
-	}
+            }
 
 	bool isZero (const PolElement& b) const
-	{
+            {
 		return _pD.isZero(b) ;
-	}
+            }
 
 	bool isOne (const PolElement& b) const
-	{
+            {
 		return _pD.isOne(b) ;
-	}
+            }
 
 
 	template<class RandIter> Element& random(RandIter& g, Element& r) const
-	{
-	       	return _pD.random(g,r,Degree(_exponent-1));
-	}
+            {
+	       	return _pD.random(g,r,Degree((long)_exponent-1));
+            }
 	template<class RandIter> Element& random(RandIter& g, Element& r, long s) const
-	{
+            {
 	       	return _pD.random(g,r,(s>=_exponent?_exponent-1:s));
-	}
+            }
 	template<class RandIter> Element& random(RandIter& g, Element& r, const Element& b) const
-	{
+            {
 	      	return _pD.random(g,r,b.size());
-	}
+            }
 	template<class RandIter> Element& nonzerorandom(RandIter& g, Element& r) const
-	{
-	       	return _pD.nonzerorandom(g,r,Degree(_exponent-1));
-	}
+            {
+	       	return _pD.nonzerorandom(g,r,Degree((long)_exponent-1));
+            }
 	template<class RandIter> Element& nonzerorandom(RandIter& g, Element& r, long s) const
-	{
+            {
 	       	return _pD.nonzerorandom(g,r,(s>=_exponent?_exponent-1:s));
-	}
+            }
 	template<class RandIter> Element& nonzerorandom(RandIter& g, Element& r, const Element& b) const
-	{
+            {
 	      	return _pD.nonzerorandom(g,r,b.size());
-	}
+            }
 
 
 
 
 	Integer &cardinality (Integer &c) const
-	{
+            {
 	       	return c=_cardinality;
-	}
+            }
 
 	Residu_t cardinality() const
-	{
+            {
 		return _cardinality ;
-	}
+            }
 
 	Integer &characteristic (Integer &c) const
-	{
+            {
 	       	return c=_characteristic;
-	}
+            }
 
 	Residu_t characteristic() const
-	{
+            {
 		return _characteristic;
-	}
+            }
+
+	unsigned long & characteristic(unsigned long & c) const
+            {
+		return c = (unsigned long) _characteristic;
+            }
 
 	Residu_t exponent() const
-	{
+            {
 		return _exponent;
-	}
+            }
 
 	Residu_t order() const
-	{
+            {
 		return _extension_order;
-	}
+            }
 
+    	PolElement& irreducible(PolElement& P) const
+            {
+                return _pD.assign(P, _irred);
+            }
+
+    	const PolElement& irreducible() const {
+            return _irred;
+        }
 
 	const BaseField_t& base_field() const
-	{
+            {
 		return _bF;
-	}
+            }
 
 
 	const Pol_t&  polynomial_domain() const
-	{
+            {
 		return _pD;
-	}
+            }
 
 
 
 	std::ostream&  write( std::ostream& o ) const
-	{
+            {
 		return _pD.write( _pD.write(o) << "/(", _irred) << ")";
-	}
+            }
 
 
 	std::istream& read ( std::istream& s, PolElement& a ) const
-	{
+            {
 		_pD.read( s, a);
 		_pD.modin( a, _irred);
 		return s;
-	}
+            }
 
 	std::ostream& write( std::ostream& o, const PolElement& R) const
-	{
+            {
 		return _pD.write( o, R );
-	}
+            }
 
 
 	std::istream&  read( std::istream& o ) const
-	{
+            {
 		std::cerr << "READ Extension, NOT YET IMPLEMENTED" << std::endl;
 		return o;
-	}
+            }
 
-};
+    };
 
+//! Extension rand iters
+    template <class ExtensionField, class Type>
+    class GIV_ExtensionrandIter {
 
-template <class ExtensionField, class Type>
-class GIV_ExtensionrandIter {
+    public:
 
-public:
+            /** @name Common Object Interface.
+             * These methods are required of all LinBox random field Element generators.
+             */
+            //@{
 
-	/** @name Common Object Interface.
-	 * These methods are required of all LinBox random field Element generators.
-	 */
-	//@{
-
-	/** Field Element type.
-	 * The field Element must contain a default constructor,
-	 * a copy constructor, a destructor, and an assignment operator.
-	 */
+            /** Field Element type.
+             * The field Element must contain a default constructor,
+             * a copy constructor, a destructor, and an assignment operator.
+             */
 	typedef typename ExtensionField::PolElement Element;
 
-	/** Constructor from field, sampling size, and seed.
-	 * The random field Element iterator works in the field F, is seeded
-	 * by seed, and it returns any one Element with probability no more
-	 * than 1/min(size, F.cardinality()).
-	 * A sampling size of zero means to sample from the entire field.
-	 * A seed of zero means to use some arbitrary seed for the generator.
-	 * This implementation sets the sampling size to be no more than the
-	 * cardinality of the field.
-	 * @param F LinBox field archetype object in which to do arithmetic
-	 * @param size constant integer reference of sample size from which to
-	 *             sample (default = 0)
-	 * @param seed constant integer reference from which to seed random number
-	 *             generator (default = 0)
-	 */
+            /** Constructor from field, sampling size, and seed.
+             * The random field Element iterator works in the field F, is seeded
+             * by seed, and it returns any one Element with probability no more
+             * than 1/min(size, F.cardinality()).
+             * A sampling size of zero means to sample from the entire field.
+             * A seed of zero means to use some arbitrary seed for the generator.
+             * This implementation sets the sampling size to be no more than the
+             * cardinality of the field.
+             * @param F LinBox field archetype object in which to do arithmetic
+             * @param size constant integer reference of sample size from which to
+             *             sample (default = 0)
+             * @param seed constant integer reference from which to seed random number
+             *             generator (default = 0)
+             */
 	GIV_ExtensionrandIter(const  ExtensionField& F,
 			      const Type& size = 0,
 			      const Type& seed = 0) :
 	       	_size(size), _givrand( GivRandom(seed) ), _field(F)
-	{
+            {
 		Type charact    = Type( F.characteristic() );
 		if ((_size > charact) || (_size == 0) )
-			_size = charact;
-	}
-
-	/** Copy constructor.
-	 * Constructs ALP_randIter object by copying the random field
-	 * Element generator.
-	 * This is required to allow generator objects to be passed by value
-	 * into functions.
-	 * In this implementation, this means copying the random field Element
-	 * generator to which R._randIter_ptr points.
-	 * @param  R ALP_randIter object.
-	 */
+                    _size = charact;
+            }
+
+            /** Copy constructor.
+             * Constructs ALP_randIter object by copying the random field
+             * Element generator.
+             * This is required to allow generator objects to be passed by value
+             * into functions.
+             * In this implementation, this means copying the random field Element
+             * generator to which R._randIter_ptr points.
+             * @param  R ALP_randIter object.
+             */
 	GIV_ExtensionrandIter(const GIV_ExtensionrandIter& R) :
 	       	_size(R._size), _givrand(R._givrand) , _field(R._field)
-       	{}
+            {}
 
-	/** Destructor.
-	 * This destructs the random field Element generator object.
-	 * In this implementation, this destroys the generator by deleting
-	 * the random generator object to which _randIter_ptr points.
-	 */
+            /** Destructor.
+             * This destructs the random field Element generator object.
+             * In this implementation, this destroys the generator by deleting
+             * the random generator object to which _randIter_ptr points.
+             */
 	~GIV_ExtensionrandIter(void) {}
 
-	/** Assignment operator.
-	 * Assigns ALP_randIter object R to generator.
-	 * In this implementation, this means copying the generator to
-	 * which R._randIter_ptr points.
-	 * @param  R ALP_randIter object.
-	 */
+            /** Assignment operator.
+             * Assigns ALP_randIter object R to generator.
+             * In this implementation, this means copying the generator to
+             * which R._randIter_ptr points.
+             * @param  R ALP_randIter object.
+             */
 	GIV_ExtensionrandIter<ExtensionField,Type>& operator= ( const GIV_ExtensionrandIter< ExtensionField, Type >& R )
-	{
+            {
 		if (this != &R) // guard against self-assignment
 		{
-			_size = R._size;
-			_givrand = R._givrand;
-			_field = R._field;
+                    _size = R._size;
+                    _givrand = R._givrand;
+                    _field = R._field;
 		}
 
 		return *this;
-	}
+            }
 
-	/** Random field Element creator with assignement.
-	 * This returns a random field Element from the information supplied
-	 * at the creation of the generator.
-	 * @return random field Element
-	 */
+            /** Random field Element creator with assignement.
+             * This returns a random field Element from the information supplied
+             * at the creation of the generator.
+             * @return random field Element
+             */
 	Element& random(Element& elt) const
-	{
-		// Create new random Elements
+            {
+                    // Create new random Elements
 		elt.resize( (size_t)(_field.order()));
 		for(typename Element::iterator it = elt.begin(); it != elt.end() ; ++ it) {
-			long tmp = static_cast<long>((double (_givrand()) / double(_GIVRAN_MODULO_)) * double(_size));
-			(_field.base_field()).init(*it , tmp);
+                    long tmp = static_cast<long>((double (_givrand()) / double(_GIVRAN_MODULO_)) * double(_size));
+                    (_field.base_field()).init(*it , tmp);
 			//(_field.base_field()) . random (*it);
 		}
 		return elt;
-	} // Element& random(Element& )
+            } // Element& random(Element& )
 
-	/** Random field Element creator with assignement.
-	 * This returns a random field Element from the information supplied
-	 * at the creation of the generator.
-	 * @return random field Element
-	 */
+            /** Random field Element creator with assignement.
+             * This returns a random field Element from the information supplied
+             * at the creation of the generator.
+             * @return random field Element
+             */
 	Element& operator()(Element& elt) const
-	{
+            {
 		return this->random(elt);
-	}
+            }
 
-	/** Random field Element creator.
-	 * This returns a random field Element from the information supplied
-	 * at the creation of the generator.
-	 * @return random field Element
-	 */
+            /** Random field Element creator.
+             * This returns a random field Element from the information supplied
+             * at the creation of the generator.
+             * @return random field Element
+             */
 	Element& operator() (void)
-	{
+            {
 		Element* x=new Element;
 		return this->random(*x);
 
-	} // Element& operator() (void)
+            } // Element& operator() (void)
 
 
 
-	//@} Common Object Iterface
+            //@} Common Object Iterface
 
-	/** @name Implementation-Specific Methods.
-	 * These methods are not required of all
-	 * \Ref{LinBox Random field Element generators}
-	 * and are included only for this implementation of the archetype.
-	 */
-	//@{
+            /** @name Implementation-Specific Methods.
+             */
+            //@{
 
-	/// Default constructor
+            /// Default constructor
 	GIV_ExtensionrandIter(void) : _size(0), _givrand(), _field() {}
 
-	//@}
+            //@}
 
-private:
+    private:
 
-	/// Sampling size
+            /// Sampling size
 	Type _size;
 
-	/// Random generator
+            /// Random generator
 	GivRandom _givrand;
 
-	/// ExtensionField
+            /// ExtensionField
 	ExtensionField _field;
 
-}; //  class GIV_ExtensionrandIter
+    }; //  class GIV_ExtensionrandIter
 
 } // namespace Givaro
 
 #endif //__GIVARO_extension_H
 
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+// vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/zpz/givgfq.h b/src/kernel/zpz/givgfq.h
index e8d6ed3..e835140 100644
--- a/src/kernel/zpz/givgfq.h
+++ b/src/kernel/zpz/givgfq.h
@@ -5,12 +5,12 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 // file: givgfq.h
-// Time-stamp: <04 Feb 11 13:42:23 Jean-Guillaume.Dumas at imag.fr>
+// Time-stamp: <08 Nov 11 15:07:32 Jean-Guillaume.Dumas at imag.fr>
 // date: 1999
 // version:
 // author: Jean-Guillaume.Dumas
 
-/*! @file zpz/givgfq.h
+/*! @file givgfq.h
  * @ingroup zpz
  * @brief   Arithmetic on GF(p^k), with p a prime number less than 2^16.
  */
@@ -27,22 +27,26 @@
 
 namespace Givaro {
 
-// ------------------------------------------------- class GFqDom
+//! class GFqDom
 template<class TT> class GFqDom {
 protected:
 	typedef typename Signed_Trait<TT>::unsigned_type UTT;
 	typedef TT Rep;
+	typedef typename std::vector<UTT>::size_type  UT  ;
 public:
 	Rep zero;
 	Rep one;
 protected:
 	UTT _characteristic;	// Field Characteristic (p)
 	UTT _exponent;		// Extension degree (k)
-	UTT _irred;			// Irreducible polynomial in p-adic
+	UTT _irred;		// Irreducible polynomial in p-adic
 	UTT _q;			// p^k
-	UTT _qm1;			// p^k-1
-	UTT _qm1o2;			// (p^k-1)/2
+	UTT _qm1;		// p^k-1
+	UTT _qm1o2;		// (p^k-1)/2
+public:
+        Rep mOne;
 
+protected:
 	// G is a generator of GF(q)
 	// p is GF(q)'s characteristic
 	// log2pol[ i ] = G^i(p)
@@ -52,6 +56,10 @@ protected:
 	std::vector<UTT> _pol2log;
 	std::vector<TT> _plus1;
 
+    	UTT zech2padic(UTT x) { return _log2pol[x]; };
+    	UTT padic2zech(UTT x) { return _pol2log[x]; };
+
+
 	// Floating point representations
 	double _dcharacteristic;
 
@@ -71,16 +79,23 @@ public:
 	typedef Rep* Array;
 	typedef const Rep* constArray;
 
-	GFqDom(): zero(0), one(1), _log2pol(0), _pol2log(0),_plus1(0) {}
+	GFqDom(): zero(0), one(1), mOne(-1), _log2pol(0), _pol2log(0),_plus1(0) {}
 
+        // Automatic construction
 	GFqDom( const UTT P, const UTT e = 1);
 
-	GFqDom( const UTT P, const UTT e, const std::vector<UTT>& modPoly);
+        // Construction with prescribed irreducible polynomial
+        //   coefficients of the vector should be integers-like
+        //   there will be a call to this->init to build the
+        //   representation of the irreducible polynomial
+    	template<typename Vector>
+    	GFqDom(const UTT P, const UTT e, const Vector& modPoly);
 
 	GFqDom( const GFqDom<TT>& F)
 	{
 		zero = F.zero;
 		one = F.one;
+                mOne = F.mOne;
 		_characteristic = F._characteristic;
 		_dcharacteristic = F._dcharacteristic;
 		_exponent = F._exponent;
@@ -106,6 +121,7 @@ public:
 	{
 		this->zero = F.zero;
 		this->one = F.one;
+		this->mOne = F.mOne;
 		this->_characteristic = F._characteristic;
 		this->_dcharacteristic = F._dcharacteristic;
 		this->_exponent = F._exponent;
@@ -124,7 +140,15 @@ public:
 	// Access to the modulus, characteristic, size, exponent
 	UTT residu() const;
 	UTT characteristic() const;
-	Integer& characteristic(Integer& p) const{return p=characteristic();}
+	Integer& characteristic(Integer& p) const
+	{
+		return p=characteristic();
+	}
+	unsigned long& characteristic(unsigned long& p) const
+	{
+		return p=(unsigned long)_characteristic;
+	}
+
 	UTT cardinality() const;
 	UTT size() const;
 	UTT exponent() const;
@@ -132,11 +156,15 @@ public:
 	Rep& generator(Rep&) const;
 	// p-adic representation of the used generator
 	UTT generator() const;
-	// an integer representation of the polynomial
+	// p-adic representation of the used irreducible polynomial
+	UTT irreducible() const;
+
+	// the internal representation of the polynomial X
 	// where the indeterminate is replaced by the characteristic
 	// This has no meaning if exponent is 1
-	UTT sage_generator() const;
-	UTT irreducible() const;
+	Rep sage_generator() const;
+	Rep indeterminate() const;
+	Rep& indeterminate(Rep&) const;
 
 	// Initialization of Elements
 	Rep& init( Rep&) const;
@@ -152,6 +180,7 @@ public:
 	Rep& init( Rep&, const unsigned long long) const ;
 #endif
 	Rep& init( Rep& a, std::istream& s ) const { return read(a,s); }
+
 	// Initialization of a polynomial
 	template<typename val_t, template<class,class> class Vector,template <class> class Alloc>
 	Rep& init( Rep&, const Vector<val_t,Alloc<val_t> >&);
diff --git a/src/kernel/zpz/givgfq.inl b/src/kernel/zpz/givgfq.inl
index de07fff..0d72593 100644
--- a/src/kernel/zpz/givgfq.inl
+++ b/src/kernel/zpz/givgfq.inl
@@ -17,12 +17,10 @@
 #define __GIVARO_gfq_INL
 
 #include <math.h>
-#include <givaro/givpoly1padic.h>
 #include <givaro/givinteger.h>
 #include <givaro/givintnumtheo.h>
 #include <givaro/givpower.h>
-
-#include <vector>
+#include <givaro/givpoly1padic.h>
 
 
 // Warning : valid iff b != c
@@ -30,47 +28,47 @@
 
 #define _GIVARO_GFQ_ADD(c, a, b, mun, plun) { if ((b)==0) (c)=(a); else if ((a)==0) (c)=(b); else { \
 	(c) = (a)-(b); \
-	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(b); \
-		(c) = ((c)>0)?(c):(c)+(mun); \
+		(c) = ((c)>0)?(c):(c)+(TT)(mun); \
 	} } }
 
 #define _GIVARO_GFQ_NEG(res, a, mo, mun) { if ( (a)==0 ) (res)=0; else\
-	{ (res) = (a) - (mo) ; (res) = ((res)>0)?(res):(res)+(mun); } }
+	{ (res) = (Rep) ( (a) - (Rep) (mo) ) ; (res) = (Rep) ( ((res)>0)?(res):(res)+(Rep)(mun) ) ; } }
 
 // Warning : valid iff a != c
 // if not use AUTOSUB ...
 #define _GIVARO_GFQ_SUB(c, a, b, mo, mun, plun) { if ((a)==0) {_GIVARO_GFQ_NEG(c,b,mo,mun);} else if ((b)==0) (c)=(a); else { \
-	(c) = (b)-(a)-(mo); \
-	(c) = ((c)>0)?(c):(c)+(mun); \
-	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = (b)-(a)-(TT)(mo); \
+	(c) = ((c)>0)?(c):(c)+(TT)(mun); \
+	(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(a); \
-		(c) = ((c)>0)?(c):(c)+(mun); \
+		(c) = ((c)>0)?(c):(c)+(TT)(mun); \
 	} } }
 #define _GIVARO_GFQ_AUTOSUB(c, b, mo, mun, plun) { if ((c)==0) {_GIVARO_GFQ_NEG(c,b,mo,mun);} else if ((b)!=0) { \
-	(c) = (c)-(b)-(mo); \
-	(c) = ((c)>0)?(c):(c)+(mun); \
-	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = (c)-(b)-(TT)(mo); \
+	(c) = ((c)>0)?(c):(c)+(TT)(mun); \
+	(c) = ((c)>0)?(c):(c)+ (TT)(mun); \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(b); \
-		(c) = ((c)>0)?(c)-(mo):(c)+(mo); \
-		(c) = ((c)>0)?(c):(c)+(mun); \
+		(c) = ((c)>0)?(c)-(TT)(mo):(c)+(TT)(mo); \
+		(c) = ((c)>0)?(c):(c)+(TT)(mun); \
 	} } }
 
 
 
-#define _GIVARO_GFQ_MUL(res, a, b, mun) { if ( ((a)==0) || ((b)==0) ) { (res) =0; } else { (res) = (((res) = (a)+(b) )>(TT)(mun))?(res)-(mun):(res); } }
+#define _GIVARO_GFQ_MUL(res, a, b, mun) { if ( ((a)==0) || ((b)==0) ) { (res) =0; } else { (res) = (((res) = (a)+(b) )>(TT)(mun))?(res)-(TT)(mun):(res); } }
 
 // JGD 02.04.1998 :  if a==1, a /= a used to be --> 0 !!!
-#define _GIVARO_GFQ_INV(res, a, mun)    { (res) = (mun)-(a); (res)=(res)?(res):(mun); }
+#define _GIVARO_GFQ_INV(res, a, mun)    { (res) = (Rep)( (Rep)(mun)-(a) ); (res)= (Rep) ( (res)?(res):(Rep)(mun) ); }
 
 #define _GIVARO_GFQ_DIV(res, a, b, mun) {  \
-	if ( (a)==0 ) { (res)=0; } else { (res) = (((res)=(a)-(b))>0)?(res):(res)+(mun); } }
+	if ( (a)==0 ) { (res)=0; } else { (res) = (((res)=(a)-(b))>0)?(res):(res)+(TT)(mun); } }
 
 
 
@@ -86,7 +84,7 @@
 		(c) = ((  (c)=((a) << 1) - (mun)        )>0)?(c):(c) + (mun); \
 	} else { \
 		(c) = ((    (c) = ((a) << 1)-(b)-(mun)             )<0)?(c)+(mun):(c); \
-		if (  (c) = (plun)[(UTT)(((c)>0)?(c):(c)+(mun))]     ) { \
+		if (  (c) = (plun)[(UT)(((c)>0)?(c):(c)+(mun))]     ) { \
 			(c) = ((    (c) = (c)+(b)         )>0)?(c):(c)+(mun); } \
 	}\
 }
@@ -95,11 +93,11 @@
 #define _GIVARO_GFQ_MULADD(c,a1,a2,b,mun,plun) { \
 	if (((a1)==0) || ((a2)==0)) { (c)=(b); \
 	} else if ((b)==0) { \
-		(c) = ((    (c)=(a1)+(a2) - (mun)       )>0)?(c):(c) + (mun); \
+		(c) = ((    (c)=(a1)+(a2) - (TT)(mun)       )>0)?(c):(c) + (TT)(mun); \
 	} else { \
-		(c) = ((    (c) = (a1)+(a2)-(b)-(mun)        )<0)?(c)+(mun):(c); \
-		if (( (c) = (plun)[(UTT)( ((c)>0)?(c):(c)+(mun)   )])  ) { \
-			(c) = ((    (c) = (c)+(b)        )>0)?(c):(c)+(mun); }\
+		(c) = ((    (c) = (a1)+(a2)-(b)-(TT)(mun)        )<0)?(c)+(TT)(mun):(c); \
+		if (( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(TT)(mun)   )])  ) { \
+			(c) = ((    (c) = (c)+(b)        )>0)?(c):(c)+(TT)(mun); }\
 	}\
 }
 
@@ -112,7 +110,7 @@
 	} else { \
 		(c) = ((    (c) = (a1)+(a2)-(b)-(mun) - (mo)       )<0)?(c)+(mun):(c); \
 		(c) = (c)<0?(c)+(mun):(c); \
-		if ( (c) = (plun)[(UTT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
+		if ( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
 			(c) = ((    (c) = (c)+(b)        )>0)?(c):(c)+(mun); }\
 	}\
 }
@@ -127,14 +125,14 @@
 #define _GIVARO_GFQ_ADD(c, a, b, mun, plun) { ++_add_call; if ((b)==0) (c)=(a); else if ((a)==0) (c)=(b); else { \
 	(c) = (a)-(b); \
 	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(b); \
 		(c) = ((c)>0)?(c):(c)+(mun); \
 	} ++_add_count; } }
 
 #define _GIVARO_GFQ_NEG(res, a, mo, mun) { ++_neg_call; if ( (a)==0 ) (res)=0; else\
-	{ (res) = (a) - (mo) ; (res) = ((res)>0)?(res):(res)+(mun); ++_neg_count; } }
+	{ (res) = (Rep) ((a) - (mo)) ; (res) = (Rep) ( ((res)>0)?(res):(res)+(mun) ); ++_neg_count; } }
 
 // Warning : valid iff a != c
 // if not use AUTOSUB ...
@@ -142,7 +140,7 @@
 	(c) = (b)-(a)-(mo); \
 	(c) = ((c)>0)?(c):(c)+(mun); \
 	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(a); \
 		(c) = ((c)>0)?(c):(c)+(mun); \
@@ -151,7 +149,7 @@
 	(c) = (c)-(b)-(mo); \
 	(c) = ((c)>0)?(c):(c)+(mun); \
 	(c) = ((c)>0)?(c):(c)+ (mun); \
-	(c) = (plun)[(UTT)(c)]; \
+	(c) = (plun)[(UT)(c)]; \
 	if (c) { \
 		(c) = (c)+(b); \
 		(c) = ((c)>0)?(c)-(mo):(c)+(mo); \
@@ -181,7 +179,7 @@
 		(c) = ((  (c)=((a) << 1) - (mun)        )>0)?(c):(c) + (mun); \
 		++_mul_count; } else { \
 			(c) = ((    (c) = ((a) << 1)-(b)-(mun)             )<0)?(c)+(mun):(c); \
-			if (  (c) = (plun)[(UTT)(((c)>0)?(c):(c)+(mun))]     ) { \
+			if (  (c) = (plun)[(UT)(((c)>0)?(c):(c)+(mun))]     ) { \
 				(c) = ((    (c) = (c)+(b)         )>0)?(c):(c)+(mun); } \
 			++_mul_count; ++_add_count;      }\
 }
@@ -193,7 +191,7 @@
 		(c) = ((    (c)=(a1)+(a2) - (mun)       )>0)?(c):(c) + (mun); \
 		++_mul_count; } else { \
 			(c) = ((    (c) = (a1)+(a2)-(b)-(mun)        )<0)?(c)+(mun):(c); \
-			if ( (c) = (plun)[(UTT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
+			if ( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
 				(c) = ((    (c) = (c)+(b)        )>0)?(c):(c)+(mun); }\
 			++_mul_count; ++_add_count;      }\
 }
@@ -207,7 +205,7 @@
 		++_mul_count; ++_neg_count;      } else { \
 			(c) = ((    (c) = (a1)+(a2)-(b)-(mun) - (mo)       )<0)?(c)+(mun):(c); \
 			(c) = (c)<0?(c)+(mun):(c); \
-			if ( (c) = (plun)[(UTT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
+			if ( (c) = (plun)[(UT)( ((c)>0)?(c):(c)+(mun)   )]  ) { \
 				(c) = ((    (c) = (c)+(b)        )>0)?(c):(c)+(mun); }\
 			++_mul_count; ++_sub_count;      }\
 }
@@ -217,933 +215,957 @@
 
 namespace Givaro {
 
-	template<typename TT>
-	inline typename GFqDom<TT>::Residu_t GFqDom<TT>::residu() const
-	{ return _q; }
-
-	template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::cardinality() const
-	{ return _q; }
-	template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::characteristic() const
-	{ return _characteristic; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Residu_t GFqDom<TT>::generator() const
-	{ return _log2pol[1]; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep& GFqDom<TT>::generator(Rep& g) const
-	{ return g=1; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Residu_t GFqDom<TT>::sage_generator() const
-	{
-		if (exponent()>1) {
-			return _pol2log[_characteristic];
-		} else {
-			return one;
-		}
-	}
+    template<typename TT>
+    inline typename GFqDom<TT>::Residu_t GFqDom<TT>::residu() const
+    { return _q; }
 
-	template<typename TT>
-	inline typename GFqDom<TT>::Residu_t GFqDom<TT>::irreducible() const
-	{ return _irred; }
+    template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::cardinality() const
+    { return _q; }
+    template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::characteristic() const
+    { return _characteristic; }
 
-	template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::exponent() const
-	{ return _exponent; }
+    template<typename TT>
+    inline typename GFqDom<TT>::Residu_t GFqDom<TT>::generator() const
+    { return _log2pol[1]; }
 
-	template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::size() const
-	{ return _q; }
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::generator(Rep& g) const
+    { return g=1; }
 
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::indeterminate(Rep& X) const
+    {
+        if (exponent()>1) {
+            return X=(Rep)_pol2log[(size_t)_characteristic];
+        } else {
+            return X=one;
+        }
+    }
 
-	// ------------------------- Miscellaneous functions
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep GFqDom<TT>::indeterminate() const
+    {
+        Rep X; return indeterminate(X);
+    }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::areEqual(const Rep& a, const Rep& b) const
-	{ return a == b ; }
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep GFqDom<TT>::sage_generator() const
+    {
+        return indeterminate();
+    }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::areNEqual(const Rep a, const Rep b) const
-	{ return a != b ; }
+    template<typename TT>
+    inline typename GFqDom<TT>::Residu_t GFqDom<TT>::irreducible() const
+    { return _irred; }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::isZero(const Rep a) const
-	{ return a == GFqDom<TT>::zero ; }
+    template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::exponent() const
+    { return _exponent; }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::isnzero(const Rep a) const
-	{ return a != GFqDom<TT>::zero ; }
+    template<typename TT> inline typename GFqDom<TT>::Residu_t GFqDom<TT>::size() const
+    { return _q; }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::isOne(const Rep a) const
-	{ return a == GFqDom<TT>::one ; }
 
-	template<typename TT>
-	inline bool GFqDom<TT>::isunit(const Rep a) const
-	{
-		// Fermat : x^(p-1) = 1 whenever x is a unit
-		return ( ( a * (_characteristic-1) ) % _qm1 ) == 0;
-	}
-
-	template<typename TT>
-	inline size_t GFqDom<TT>::length(const Rep ) const
-	{ return sizeof(TT) ;}
-
-	// ----------- Usefull method :
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::mul
-	(Rep& r, const Rep a, const Rep b) const
-	{ _GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::mulin
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_MUL(r,r,a, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::div
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b) const
-	{ _GIVARO_GFQ_DIV(r, a, b, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::divin
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_DIV(r, r, a, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::add
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b) const
-	{ _GIVARO_GFQ_ADD(r, a, b, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::addin
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_ADD(r, r, a, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::sub
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b) const
-	{ _GIVARO_GFQ_SUB(r, a, b, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::subin
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_AUTOSUB(r, a, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::neg
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_NEG(r, a, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::negin
-	(GFqDom<TT>::Rep& r) const
-	{ _GIVARO_GFQ_NEG(r, r, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::inv
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a) const
-	{ _GIVARO_GFQ_INV(r, a, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::invin
-	(GFqDom<TT>::Rep& r) const
-	{ _GIVARO_GFQ_INV(r, r, GFqDom<TT>::_qm1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axpy
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b, const GFqDom<TT>::Rep c)
-	const
-	{ _GIVARO_GFQ_MULADD(r,a,b,c, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
-
-	template<typename TT>
-	inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axpyin
-	(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b) const
-	{
-		Rep tmp = r;
-		_GIVARO_GFQ_MULADD((r),a,b,tmp, (GFqDom<TT>::_qm1), (GFqDom<TT>::_plus1)) ;
-		return r; }
-
-		// r <- r-a*b
-		template<typename TT>
-		inline typename GFqDom<TT>::Rep&  GFqDom<TT>::maxpyin (GFqDom<TT>::Rep& r,
-								       const GFqDom<TT>::Rep a,
-								       const GFqDom<TT>::Rep b) const
-		{
-			//   Rep tmp = r;
-			//   _GIVARO_GFQ_MULSUB(r,a,b,tmp, _qm1o2, _qm1, _plus1) ;
-			Rep tmp; _GIVARO_GFQ_MUL(tmp,a,b, _qm1) ;
-			_GIVARO_GFQ_AUTOSUB(r,tmp, _qm1o2, _qm1, _plus1) ;
-			return r;
-		}
-
-		template<typename TT>
-		inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axmyin (GFqDom<TT>::Rep& r,
-								      const GFqDom<TT>::Rep a,
-								      const GFqDom<TT>::Rep b) const
-		{
-			this->maxpyin(r,a,b);
-			return this->negin(r);
-		}
-
-		// r <- a*b-c
-		template<typename TT>
-		inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axmy
-		(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b, const GFqDom<TT>::Rep c)
-		const
-		{
-			_GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ;
-			_GIVARO_GFQ_AUTOSUB(r,c, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-			return r; }
-
-			template<typename TT>
-			inline typename GFqDom<TT>::Rep&  GFqDom<TT>::maxpy
-			(GFqDom<TT>::Rep& r, const GFqDom<TT>::Rep a, const GFqDom<TT>::Rep b, const GFqDom<TT>::Rep c)
-			const
-			{
-				_GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ;
-				_GIVARO_GFQ_SUB(r,c,r, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-				return r; }
-
-
-				// -- inline array operations between Reps
-				template<typename TT>
-				inline void GFqDom<TT>::mul
-				(const size_t sz, Array r, constArray a, constArray b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MUL(r[i],a[i],b[i], GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::mul
-				(const size_t sz, Array r, constArray a, Rep b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MUL(r[i],a[i],b, GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::div
-				(const size_t sz, Array r, constArray a, constArray b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_DIV(r[i],a[i],b[i], GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::div
-				(const size_t sz, Array r, constArray a, Rep b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_DIV(r[i],a[i],b, GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::add
-				(const size_t sz, Array r, constArray a, constArray b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_ADD(r[i], a[i], b[i], GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::add
-				(const size_t sz, Array r, constArray a, Rep b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_ADD(r[i], a[i], b, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::sub
-				(const size_t sz, Array r, constArray a, constArray b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_SUB(r[i], a[i], b[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::sub
-				(const size_t sz, Array r, constArray a, Rep b) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_SUB(r[i], a[i], b, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::neg
-				(const size_t sz, Array r, constArray a) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_NEG(r[i], a[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::inv
-				(const size_t sz, Array r, constArray a) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_INV(r[i], a[i], GFqDom<TT>::_qm1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::axpy
-				(const size_t sz, Array r, Rep a, constArray x, constArray y) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MULADD(r[i], a, x[i], y[i], GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::axpyin
-				(const size_t sz, Array r, Rep a, constArray x) const
-				{
-					Rep tmp;
-					for ( size_t i=sz ; --i ; ) {
-						tmp = r[i];
-						_GIVARO_GFQ_MULADD(r[i], a, x[i], tmp, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::axpy
-				(const size_t sz, Array r, Rep a, constArray x, Rep y) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MULADD(r[i], a, x[i], y, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::axmy
-				(const size_t sz, Array r, Rep a, constArray x, constArray y) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MUL(r[i], a, x[i], GFqDom<TT>::_qm1) ;
-						_GIVARO_GFQ_AUTOSUB(r[i], y[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::axmy
-				(const size_t sz, Array r, Rep a, constArray x, Rep y) const
-				{
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MUL(r[i], a, x[i], GFqDom<TT>::_qm1) ;
-						_GIVARO_GFQ_AUTOSUB(r[i], y, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				template<typename TT>
-				inline void GFqDom<TT>::maxpyin (const size_t sz, Array r,
-								 Rep a, constArray x) const
-				{
-					Rep tmp;
-					for ( size_t i=sz ; --i ; ) {
-						_GIVARO_GFQ_MUL(tmp, a, x[i], GFqDom<TT>::_qm1) ;
-						_GIVARO_GFQ_AUTOSUB(r[i], tmp, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
-					}
-				}
-
-				// ------------------------------------
-				// Input - Output  of the Domain
-				//
-				template<typename TT>
-				inline std::istream& GFqDom<TT>::read (std::istream& s) {
-					char ch;
-					s >> std::ws >> ch;
-					if (ch != '(')
-						std::cerr << "GFqDom::read: syntax error: no '('" << std::endl;
-					UTT p;
-					s >> p;
-					s >> std::ws >> ch;
-					if (ch == ')')
-						*this = GFqDom<TT>(p,UTT(1));
-					else {
-						if (ch != '^')
-							std::cerr << "GFqDom::read: syntax error: no '^'" << std::endl;
-						UTT k;
-						s >> std::ws >> k;
-						if (ch != ')')
-							std::cerr << "GFqDom::read: syntax error: no ')'" << std::endl;
-
-						*this = GFqDom<TT>(p,k);
-					}
-					return s;
-				}
-
-				template<typename TT>
-				inline std::ostream& GFqDom<TT>::write (std::ostream& o) const
-				{
-					return o << "Givaro Gfq of (" <<  GFqDom<TT>::_characteristic << '^' << GFqDom<TT>::_exponent << ')';
-				}
-
-				// ------------------------------------
-				// Input - Output  of the Elements
-				//
-				template<typename TT>
-				inline std::istream& GFqDom<TT>::read (std::istream& i, Rep& a) const
-				{
-					TT t;
-					i >> t;
-					init(a,t);
-					return i;
-				}
-
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const double Residu ) const
-				{
-					double tr = Residu ;
-					if (tr <0) {
-						// -a = b [p]  <==>  a = p-b [p]
-						tr = -tr;
-						if (tr > Signed_Trait<UTT>::max() )
-							tr = fmod(tr,_dcharacteristic);
-						//tr -= (double)floor(tr * _inversecharacteristic)*_dcharacteristic;
-						else{
-							if (tr >= (TT)_characteristic )
-								tr = double((UTT)tr % _characteristic) ;
-						}
-
-						if (tr)
-							return r = _pol2log[ _characteristic - (UTT)tr ];
-						else
-							return r = zero;
-					} else {
-						if (tr > Signed_Trait<UTT>::max() )
-							tr = fmod(tr,_dcharacteristic);
-						//tr -= (double)floor(tr * _inversecharacteristic)*_dcharacteristic;
-						else{
-							if (tr >= (TT)_characteristic )
-								tr = double((UTT)tr % _characteristic) ;
-						}
-						return r = _pol2log[ (UTT)tr ];
-					}
-				}
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const float Residu ) const
-				{
-					return init(r, static_cast<double>(Residu));
-				}
-
-
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const int Residu ) const
-				{
-					int tr = Residu ;
-					if (tr <0) {
-						// -a = b [p]
-						// a = p-b [p]
-						tr = -tr;
-						if (tr >= (int)_characteristic )
-							tr =(int)( (unsigned int)tr % _characteristic ) ;
-						if (tr)
-							return r = _pol2log[ _characteristic - (unsigned int)tr ];
-						else
-							return r = zero;
-					}
-					else {
-						if (tr >= (int)_characteristic )
-							tr = int((unsigned int)tr % _characteristic ) ;
-						return r = _pol2log[ tr ];
-					}
-				}
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const long Residu ) const
-				{
-					long tr = Residu ;
-					if (tr <0) {
-						// -a = b [p]
-						// a = p-b [p]
-						tr = -tr;
-						if (tr >= (long)_characteristic ) tr = (unsigned long)tr % _characteristic ;
-						if (tr)
-							return r = _pol2log[ _characteristic - (unsigned long)tr ];
-						else
-							return r = zero;
-					} else {
-						if (tr >= (long)_characteristic ) tr = (unsigned long)tr % _characteristic ;
-						return r = _pol2log[ tr ];
-					}
-				}
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const Integer Residu ) const
-				{
-					UTT tr;
-					if (Residu <0) {
-						// -a = b [p]
-						// a = p-b [p]
-						if ( Residu <= (Integer)(-_characteristic) ) tr =  (-Residu) % (UTT)_characteristic ;
-						else
-							tr = UTT(-Residu);
-						if (tr)
-							return r = _pol2log[ _characteristic - (UTT)tr ];
-						else
-							return r = zero;
-					} else {
-						if (Residu >= (Integer)_characteristic ) tr =  Residu % (UTT)_characteristic ;
-						else tr = UTT(Residu);
-						return r = _pol2log[ tr ];
-					}
-				}
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned long Residu ) const
-				{
-					unsigned long tr = Residu ;
-					if (tr >= _characteristic ) tr = tr % _characteristic ;
-					return r = _pol2log[ tr ];
-				}
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned int Residu ) const
-				{
-					unsigned int tr = Residu ;
-					if (tr >= _characteristic ) tr = tr % _characteristic ;
-					return r = _pol2log[ tr ];
-				}
 
-#ifndef __GIVARO__DONOTUSE_longlong__
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned long long Residu ) const
-				{
-					unsigned long long tr = Residu ;
-					if (tr >= _characteristic ) tr = tr % _characteristic ;
-					return r = _pol2log[ tr ];
-				}
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const long long Residu ) const
-				{
-					long long tr = Residu ;
-					if (tr <0) {
-						// -a = b [p]
-						// a = p-b [p]
-						tr = -tr;
-						if (tr >= (long long)_characteristic ) tr = (unsigned long long)tr % _characteristic ;
-						if (tr)
-							return r = _pol2log[ _characteristic - (unsigned long long)tr ];
-						else
-							return r = zero;
-					} else {
-						if (tr >= (long long)_characteristic ) tr = (unsigned long long)tr % _characteristic ;
-						return r = _pol2log[ tr ];
-					}
-				}
-
-
-				template<typename TT>
-				inline unsigned long long& GFqDom<TT>::convert (unsigned long long& r, const Rep a) const
-				{
-					return r = (unsigned long long)_log2pol[ (unsigned long)a] ;
-				}
-				template<typename TT>
-				inline long long& GFqDom<TT>::convert (long long& r, const Rep a) const
-				{
-					return r = (long long)_log2pol[ (unsigned long)a] ;
-				}
-
-#endif
-
-
-				template<typename TT>
-				inline double& GFqDom<TT>::convert (double& r, const Rep a) const
-				{
-					return r = (double)_log2pol[ (UTT)a] ;
-				}
-
-				template<typename TT>
-				inline float& GFqDom<TT>::convert (float& r, const Rep a) const
-				{
-					return r = (float)_log2pol[ (UTT)a] ;
-				}
-
-				template<typename TT>
-				inline std::ostream& GFqDom<TT>::write (std::ostream& o, const Rep a) const
-				{
-					return o << _log2pol[ (UTT)a] ;
-				}
-
-
-
-				template<typename TT>
-				inline long& GFqDom<TT>::convert (long& r, const Rep a) const
-				{
-					return r = (long)_log2pol[ (unsigned long)a] ;
-				}
-
-				template<typename TT>
-				inline unsigned long& GFqDom<TT>::convert (unsigned long& r, const Rep a) const
-				{
-					return r = (unsigned long)_log2pol[ (unsigned long)a] ;
-				}
-
-				template<typename TT>
-				inline int& GFqDom<TT>::convert (int& r, const Rep a) const
-				{
-					return r = (int)_log2pol[ (UTT)a] ;
-				}
-
-				template<typename TT>
-				inline unsigned int& GFqDom<TT>::convert (unsigned int& r, const Rep a) const
-				{
-					return r = (unsigned int)_log2pol[ (UTT)a] ;
-				}
-
-				template<typename TT>
-				inline TT GFqDom<TT>::convert (const Rep a) const
-				{
-					return (TT)_log2pol[ (UTT)a] ;
-				}
-
-				template<typename TT>
-				inline Integer& GFqDom<TT>::convert (Integer& r, const Rep a) const
-				{
-					return r = (Integer)_log2pol[ (UTT)a] ;
-				}
-
-
-				// ---------
-				// -- Initialization operations
-				// ---------
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r) const
-				{ return r = zero; }
-
-
-				template<typename TT>
-				template<typename val_t, template<class, class> class Vector, template <class> class Alloc>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const Vector<val_t, Alloc<val_t> >& P) {
-					static Self_t PrimeField(this->_characteristic);
-					typedef Poly1Dom< Self_t, Dense > PolDom;
-					static PolDom Pdom( PrimeField );
-					typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
-					static PadicDom PAD(Pdom);
-					Degree d;  Pdom.degree(d, P);
-					if (d >= this->_exponent) {
-						static typename PadicDom::Element tmp;
-						static typename PadicDom::Element Irreducible = PAD.radix(tmp, this->_irred);
-						// All this was to get the irreducible polynomial
-						// Now we can mod it out
-						typename PolDom::Element modP; Pdom.mod(modP, P, Irreducible);
-						TT tr;
-						PAD.eval(tr, modP);
-						return r = this->_pol2log[ tr ];
-					} else {
-						TT tr;
-						PAD.eval(tr, P);
-						return r = this->_pol2log[ tr ];
-					}
-				}
-
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::assign( Rep& r, const Integer a) const
-				{ return init (r, a); }
-
-				template<typename TT>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::assign( Rep& r, const Rep a) const
-				{ return r = a; }
-
-
-				template<typename TT> inline void GFqDom<TT>::assign( const size_t sz, Array r, constArray a ) const
-				{
-					TT tr;
-					//    for ( size_t i=sz ; --i ; )
-					for ( size_t i=sz; i--;) {
-						tr = a[i] ;
-						if (tr <0) {
-							// -a = b [p]
-							// a = p-b [p]
-							tr = -tr;
-							if (tr >=_characteristic ) tr = tr % _characteristic ;
-							if (tr)
-								r[i] = _pol2log[ _characteristic - tr ];
-							else
-								r[i] = 0;
-						} else {
-							if (tr >=_characteristic ) tr = tr % _characteristic ;
-							r[i] = _pol2log[ tr ];
-						}
-					}
-				}
-
-				template<typename TT>
-				inline typename  GFqDom<TT>::Rep& GFqDom<TT>::dotprod
-				( Rep& r, const size_t sz, constArray a, constArray b ) const
-				{
-					if (sz) {
-						_GIVARO_GFQ_MUL(r,a[0],b[0],_qm1);
-						Rep tmp;
-						for(  int i= sz; --i; ) {
-							_GIVARO_GFQ_MUL(tmp,a[i],b[i],_qm1);
-							_GIVARO_GFQ_ADD(r,r,tmp,_qm1,_plus1);
-						}
-						return r;
-					} else
-						return r = zero;
-				}
-
-
-				// ----- random generators
-				template<typename TT> template<typename RandIter> inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& a) const
-				{
-					//     do
-					//         a = Rep( (UTT)(lrand48()) % _q);
-					//     while (isZero(a));
-					//     a = (a<0?a+_q:a);
-					//     return a;
-					a = Rep( ((UTT)(g()) % (_q-1)) + 1);
-					return a = (a<0?a+_q:a);
-
-				}
-
-				template<typename TT> template<typename RandIter> inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& a) const
-				{
-					a = Rep( (UTT)(g()) % _q);
-					return a = (a<0?a+_q:a);
-				}
-
-				template<typename TT> template<typename RandIter>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& r, long s) const
-				{
-					return random(g,r);
-				}
-
-
-				template<typename TT> template<typename RandIter>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& r, const Rep& b) const
-				{
-					return random(g,r);
-				}
-
-				template<typename TT> template<typename RandIter>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& r, long s) const
-				{
-					return nonzerorandom(g,r);
-				}
-
-				template<typename TT> template<typename RandIter>
-				inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& r, const Rep& b) const
-				{
-					return nonzerorandom(g,r);
-				}
-
-
-
-
-				template<typename TT>
-				inline GFqDom<TT>::GFqDom(const UTT P, const UTT e)
-				// Precondition P prime
-				:  zero(0)
-				   , one (power(P,e) - 1  )
-				   , _characteristic(P)
-				   , _exponent(e)
-				   , _q( one + 1 )
-				   , _qm1 ( one )
-				   , _qm1o2(  (P==2)?  (one)  :  (_q >> 1) )   // 1 == -1 in GF(2^k)
-				   , _log2pol( _q )
-				   , _pol2log( _q )
-				   , _plus1( _q )
-				   , _dcharacteristic( (double)P )
-				   {
-
-					   // 1 is represented by q-1, zero by 0
-					   _log2pol[0] = zero;
-
-					   if (e <= 1) {
-						   IntNumTheoDom<> NTD;
-						   IntNumTheoDom<>::Rep IP(P), pr;
-						   //         UTT seed = (UTT) ( NTD.Integer2long( NTD.lowest_prim_root(pr, IP) ) );
-						   UTT seed;
-						   NTD.convert(seed, NTD.lowest_prim_root(pr, IP) );
-						   UTT accu = 1;
-						   for(UTT i=1; i<P; i++) {
-							   accu = (accu * seed) % P;
-							   _log2pol[i] = accu;
-						   }
-					   } else {
-						   // Fisrt compute an irreductible polynomial F over Z/pZ of degree e
-						   // Then a primitive root G (i.e. a generator of GF(q))
-						   GFqDom<TT> Zp(P,1);
-						   //         typedef CyclotomicTable<  GFqDom<TT>, Dense > PolDom;
-						   //         PolDom Pdom( Zp, e );
-						   typedef Poly1FactorDom< Self_t, Dense > PolDom;
-						   PolDom Pdom( Zp );
-						   typename PolDom::Element F, G, H;
-
-						   // F is irreducible of degree e over Zp
-						   // G is a primitive polynomial for F
-						   //         Pdom.random_prim_root(F,G, Degree(e));
-
-						   // F is an irreducible factor of the
-						   // (p^e-1) th cyclotomic polynomial
-						   // G is a primitive polynomial for F : X
-						   //         Pdom.getcyclo(F);
-						   //         Pdom.init(G, Degree(1), Zp.one);
-
-						   // F is irreducible of degree e over Zp
-						   // with X as a primitive polynomial
-#ifndef GIVARO_RANDOM_IRREDUCTIBLE_PRIMITIVE_ROOT
-						   Pdom.ixe_irreducible(F, Degree(e));
-						   //         Pdom.init(G, Degree(1), Zp.one);
-						   //         Pdom.assign(G, Degree(1), Zp.one);
-						   Pdom.init(G, Degree(1));
-#else
-						   Pdom.random_irreducible(F, Degree(e));
-						   Pdom.give_random_prim_root(G,F);
-#endif
-
-						   Pdom.assign(H, G);
-
-						   typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
-						   PadicDom PAD(Pdom);
-
-						   PAD.eval(_log2pol[1], H);
-						   PAD.eval(_irred, F);
-
-						   for (UTT i = 2; i < _qm1; ++i) {
-							   Pdom.mulin(H, G);
-							   Pdom.modin(H, F);
-							   PAD.eval(_log2pol[i], H);
-						   }
-
-						   _log2pol[_qm1] = 1;
-
-					   }
-
-					   _log2pol[0] = 0;
-
-					   // pol2log[ j ] = i such that log2pol[i] = j
-					   for (UTT i = 0; i < _q; ++i)
-						   _pol2log[ _log2pol[i] ] = i;
-
-					   // plus1[i] = k such that G^i + 1 = G^k
-					   // WARNING : in the plus1 table, we now pre-substract (_q - 1)
-					   _plus1[0] = 0;
+	// ------------------------- Miscellaneous functions
 
-					   UTT a,b,r;
-					   for (UTT i = 1; i < _q; ++i) {
-						   a = _log2pol[i];
-						   r = a % P;
-						   if (r == (P - 1))
-							   b = a - r;
-						   else
-							   b = a + 1;
-						   // WARNING : in the plus1 table we pre-substract (_q - 1)
-						   _plus1[i] = _pol2log[b] - _qm1;
-					   }
-					   // -1 + 1 == 0
-					   _plus1[_qm1o2] = 0;
-				   }
+    template<typename TT>
+    inline bool GFqDom<TT>::areEqual(const Rep& a, const Rep& b) const
+    { return a == b ; }
 
-				// Dan Roche 6-15-04, adapted my/ported back to Givaro
-				// by Martin Albrecht 10-06-06
-				// This constructor takes a vector of ints that represent the polynomial
-				// to use (for modular arithmetic on the extension field).
-				template<typename TT>
-				inline GFqDom<TT>::GFqDom(const UTT P, const UTT e, const std::vector<UTT>& modPoly):
-					zero(0)
-					, one (power(P,e) - 1  )
-					, _characteristic(P)
-					, _exponent(e)
-					, _q( one + 1 )
-					, _qm1 ( one )
-					, _qm1o2(  (P==2)?  (one)  :  (_q >> 1) )   // 1 == -1 in GF(2^k)
-					, _log2pol( _q )
-					, _pol2log( _q )
-					, _plus1( _q )
-					, _dcharacteristic( (double)P )
-					{
+    template<typename TT>
+    inline bool GFqDom<TT>::areNEqual(const Rep a, const Rep b) const
+    { return a != b ; }
 
-						// 1 is represented by q-1, zero by 0
-						_log2pol[0] = zero;
+    template<typename TT>
+    inline bool GFqDom<TT>::isZero(const Rep a) const
+    { return a == GFqDom<TT>::zero ; }
 
-						GFqDom<TT> Zp(P,1);
-						typedef Poly1FactorDom< GFqDom<TT>, Dense > PolDom;
-						PolDom Pdom( Zp );
-						typename PolDom::Element Ft, F, G, H;
+    template<typename TT>
+    inline bool GFqDom<TT>::isnzero(const Rep a) const
+    { return a != GFqDom<TT>::zero ; }
 
-						typename PolDom::Element tempVector(e+1);
-						for( int i = 0; i < e+1; i++ )
-							Zp.init( tempVector[i], modPoly[i]);
-						Pdom.assign( F, tempVector );
+    template<typename TT>
+    inline bool GFqDom<TT>::isOne(const Rep a) const
+    { return a == GFqDom<TT>::one ; }
 
-						Pdom.give_prim_root(G,F);
-						Pdom.assign(H,G);
+    template<typename TT>
+    inline bool GFqDom<TT>::isunit(const Rep a) const
+    {
+            // Fermat : x^(p-1) = 1 whenever x is a unit
+        return ( ( a * (_characteristic-1) ) % _qm1 ) == 0;
+    }
 
-						typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
-						PadicDom PAD(Pdom);
+    template<typename TT>
+    inline size_t GFqDom<TT>::length(const Rep ) const
+    { return sizeof(TT) ;}
 
-						PAD.eval(_log2pol[1],H);
+	// ----------- Usefull method :
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::mul
+    (Rep& r, const Rep a, const Rep b) const
+    { _GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::mulin
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_MUL(r,r,a, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::div
+    (Rep& r, const Rep a, const Rep b) const
+    {
+	   	_GIVARO_GFQ_DIV(r, a, b, GFqDom<TT>::_qm1) ;
+		return r;
+	}
 
-						for (UTT i = 2; i < _qm1; ++i) {
-							Pdom.mulin(H, G);
-							Pdom.modin(H, F);
-							PAD.eval(_log2pol[i], H);
-						}
-						_log2pol[_qm1] = 1;
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::divin
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_DIV(r, r, a, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::add
+    (Rep& r, const Rep a, const Rep b) const
+    { _GIVARO_GFQ_ADD(r, a, b, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::addin
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_ADD(r, r, a, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::sub
+    (Rep& r, const Rep a, const Rep b) const
+    { _GIVARO_GFQ_SUB(r, a, b, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::subin
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_AUTOSUB(r, a, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::neg
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_NEG(r, a, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::negin
+    (Rep& r) const
+    { _GIVARO_GFQ_NEG(r, r, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::inv
+    (Rep& r, const Rep a) const
+    { _GIVARO_GFQ_INV(r, a, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::invin
+    (Rep& r) const
+    { _GIVARO_GFQ_INV(r, r, GFqDom<TT>::_qm1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axpy
+    (Rep& r, const Rep a, const Rep b, const Rep c)
+	const
+    { _GIVARO_GFQ_MULADD(r,a,b,c, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ; return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axpyin
+    (Rep& r, const Rep a, const Rep b) const
+    {
+        Rep tmp = r;
+        _GIVARO_GFQ_MULADD((r),a,b,tmp, (GFqDom<TT>::_qm1), (GFqDom<TT>::_plus1)) ;
+        return r;
+	}
 
-						_log2pol[0] = 0;
+        // r <- r-a*b
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::maxpyin (Rep& r,
+                                                           const Rep a,
+                                                           const Rep b) const
+    {
+            //   Rep tmp = r;
+            //   _GIVARO_GFQ_MULSUB(r,a,b,tmp, _qm1o2, _qm1, _plus1) ;
+        Rep tmp; _GIVARO_GFQ_MUL(tmp,a,b, _qm1) ;
+        _GIVARO_GFQ_AUTOSUB(r,tmp, _qm1o2, _qm1, _plus1) ;
+        return r;
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axmyin (Rep& r,
+                                                          const Rep a,
+                                                          const Rep b) const
+    {
+        this->maxpyin(r,a,b);
+        return this->negin(r);
+    }
+
+        // r <- a*b-c
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::axmy
+    (Rep& r, const Rep a, const Rep b, const Rep c)
+        const
+    {
+        _GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ;
+        _GIVARO_GFQ_AUTOSUB(r,c, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        return r; }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep&  GFqDom<TT>::maxpy
+    (Rep& r, const Rep a, const Rep b, const Rep c)
+        const
+    {
+        _GIVARO_GFQ_MUL(r,a,b, GFqDom<TT>::_qm1) ;
+        _GIVARO_GFQ_SUB(r,c,r, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        return r; }
+
+
+        // -- inline array operations between Reps
+    template<typename TT>
+    inline void GFqDom<TT>::mul
+    (const size_t sz, Array r, constArray a, constArray b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MUL(r[i],a[i],b[i], GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::mul
+    (const size_t sz, Array r, constArray a, Rep b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MUL(r[i],a[i],b, GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::div
+    (const size_t sz, Array r, constArray a, constArray b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_DIV(r[i],a[i],b[i], GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::div
+    (const size_t sz, Array r, constArray a, Rep b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_DIV(r[i],a[i],b, GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::add
+    (const size_t sz, Array r, constArray a, constArray b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_ADD(r[i], a[i], b[i], GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::add
+    (const size_t sz, Array r, constArray a, Rep b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_ADD(r[i], a[i], b, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::sub
+    (const size_t sz, Array r, constArray a, constArray b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_SUB(r[i], a[i], b[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::sub
+    (const size_t sz, Array r, constArray a, Rep b) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_SUB(r[i], a[i], b, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::neg
+    (const size_t sz, Array r, constArray a) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_NEG(r[i], a[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::inv
+    (const size_t sz, Array r, constArray a) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_INV(r[i], a[i], GFqDom<TT>::_qm1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::axpy
+    (const size_t sz, Array r, Rep a, constArray x, constArray y) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MULADD(r[i], a, x[i], y[i], GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::axpyin
+    (const size_t sz, Array r, Rep a, constArray x) const
+    {
+        Rep tmp;
+        for ( size_t i=sz ; --i ; ) {
+            tmp = r[i];
+            _GIVARO_GFQ_MULADD(r[i], a, x[i], tmp, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::axpy
+    (const size_t sz, Array r, Rep a, constArray x, Rep y) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MULADD(r[i], a, x[i], y, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::axmy
+    (const size_t sz, Array r, Rep a, constArray x, constArray y) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MUL(r[i], a, x[i], GFqDom<TT>::_qm1) ;
+            _GIVARO_GFQ_AUTOSUB(r[i], y[i], GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::axmy
+    (const size_t sz, Array r, Rep a, constArray x, Rep y) const
+    {
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MUL(r[i], a, x[i], GFqDom<TT>::_qm1) ;
+            _GIVARO_GFQ_AUTOSUB(r[i], y, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+    template<typename TT>
+    inline void GFqDom<TT>::maxpyin (const size_t sz, Array r,
+                                     Rep a, constArray x) const
+    {
+        Rep tmp;
+        for ( size_t i=sz ; --i ; ) {
+            _GIVARO_GFQ_MUL(tmp, a, x[i], GFqDom<TT>::_qm1) ;
+            _GIVARO_GFQ_AUTOSUB(r[i], tmp, GFqDom<TT>::_qm1o2, GFqDom<TT>::_qm1, GFqDom<TT>::_plus1) ;
+        }
+    }
+
+        // ------------------------------------
+        // Input - Output  of the Domain
+        //
+    template<typename TT>
+    inline std::istream& GFqDom<TT>::read (std::istream& s) {
+        char ch;
+        s >> std::ws >> ch;
+        if (ch != '(')
+            std::cerr << "GFqDom::read: syntax error: no '('" << std::endl;
+        UTT p;
+        s >> p;
+        s >> std::ws >> ch;
+        if (ch == ')')
+            *this = GFqDom<TT>(p,UTT(1));
+        else {
+            if (ch != '^')
+                std::cerr << "GFqDom::read: syntax error: no '^'" << std::endl;
+            UTT k;
+            s >> std::ws >> k;
+            if (ch != ')')
+                std::cerr << "GFqDom::read: syntax error: no ')'" << std::endl;
+
+            *this = GFqDom<TT>(p,k);
+        }
+        return s;
+    }
+
+    template<typename TT>
+    inline std::ostream& GFqDom<TT>::write (std::ostream& o) const
+    {
+        return o << "Givaro Gfq of (" <<  GFqDom<TT>::_characteristic << '^' << GFqDom<TT>::_exponent << ')';
+    }
+
+        // ------------------------------------
+        // Input - Output  of the Elements
+        //
+    template<typename TT>
+    inline std::istream& GFqDom<TT>::read (std::istream& i, Rep& a) const
+    {
+        TT t;
+        i >> t;
+        init(a,t);
+        return i;
+    }
+
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const double Residu ) const
+    {
+        double tr = Residu ;
+        if (tr <0) {
+                // -a = b [p]  <==>  a = p-b [p]
+            tr = -tr;
+            if (tr > Signed_Trait<UTT>::max() )
+                tr = fmod(tr,_dcharacteristic);
+                //tr -= (double)floor(tr * _inversecharacteristic)*_dcharacteristic;
+            else{
+                if (tr >= (TT)_characteristic )
+                    tr = double((UTT)tr % _characteristic) ;
+            }
+
+            if (tr)
+                return r = (Rep)_pol2log[ UT(_characteristic - (UTT)tr) ];
+            else
+                return r = zero;
+        } else {
+            if (tr > Signed_Trait<UTT>::max() )
+                tr = fmod(tr,_dcharacteristic);
+                //tr -= (double)floor(tr * _inversecharacteristic)*_dcharacteristic;
+            else{
+                if (tr >= (TT)_characteristic )
+                    tr = double((UTT)tr % _characteristic) ;
+            }
+            return r = (Rep)_pol2log[ (UT)tr ];
+        }
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const float Residu ) const
+    {
+        return init(r, static_cast<double>(Residu));
+    }
+
+
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const int Residu ) const
+    {
+        int tr = Residu ;
+        if (tr <0) {
+                // -a = b [p]
+                // a = p-b [p]
+            tr = -tr;
+            if (tr >= (int)_characteristic )
+                tr =(int)( (UT)tr % _characteristic ) ;
+            if (tr)
+                return r = (Rep) _pol2log[(UT) _characteristic - (UT)tr ];
+            else
+                return r = zero;
+        }
+        else {
+            if (tr >= (int)_characteristic )
+                tr = int((unsigned int)tr % _characteristic ) ;
+            return r = (Rep)_pol2log[ (UT)tr ];
+        }
+    }
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const long Residu ) const
+    {
+        long tr = Residu ;
+        if (tr <0) {
+                // -a = b [p]
+                // a = p-b [p]
+            tr = -tr;
+            if (tr >= (long)_characteristic )
+				tr = tr % (long)_characteristic ;
+            if (tr)
+                return r = (typename GFqDom<TT>::Rep) _pol2log[ (size_t)_characteristic - (size_t)tr ];
+            else
+                return r = zero;
+        } else {
+            if (tr >= (long)_characteristic )
+				tr = tr % (long)_characteristic ;
+            return r = (Rep)_pol2log[ (size_t)tr ];
+        }
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const Integer Residu ) const
+    {
+        UTT tr;
+        if (Residu <0) {
+                // -a = b [p]
+                // a = p-b [p]
+            if ( Residu <= (Integer)(-_characteristic) )
+				tr = (UTT) (  (-Residu) % (UTT)_characteristic );
+            else
+                tr = UTT(-Residu);
+            if (tr)
+                return r = (Rep)_pol2log[ _characteristic - (UTT)tr ];
+            else
+                return r = zero;
+        }
+		else { /* Residu >=0 */
+            if (Residu >= (Integer)_characteristic )
+				tr =  (UTT)(Residu % (UTT)_characteristic );
+            else
+				tr = UTT(Residu);
+            return r = (Rep)_pol2log[ (size_t)tr ];
+        }
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned long Residu ) const
+    {
+        unsigned long tr = Residu ;
+        if (tr >= _characteristic )
+			tr =tr %  (unsigned long) _characteristic ;
+        return r = (Rep)_pol2log[ (size_t)tr ];
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned int Residu ) const
+    {
+        unsigned int tr = Residu ;
+        if (tr >= _characteristic ) tr = tr % _characteristic ;
+        return r = (Rep)_pol2log[ (size_t)tr ];
+    }
 
-						for (UTT i = 0; i < _q; ++i)
-							_pol2log[ _log2pol[i] ] = i;
-
-						_plus1[0] = 0;
-
-						UTT a,b,r;
-						for (UTT i = 1; i < _q; ++i) {
-							a = _log2pol[i];
-							r = a % P;
-							if (r == (P - 1))
-								b = a - r;
-							else
-								b = a + 1;
-							_plus1[i] = _pol2log[b] - _qm1;
-						}
-
-						_plus1[_qm1o2] = 0;
-					}
+#ifndef __GIVARO__DONOTUSE_longlong__
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const unsigned long long Residu ) const
+    {
+        unsigned long long tr = Residu ;
+        if (tr >= _characteristic ) tr = tr % _characteristic ;
+        return r = (Rep)_pol2log[ (size_t)tr ];
+    }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const long long Residu ) const
+    {
+        long long tr = Residu ;
+        if (tr <0) {
+                // -a = b [p]
+                // a = p-b [p]
+            tr = -tr;
+            if (tr >= (long long)_characteristic ) tr = (unsigned long long)tr % _characteristic ;
+            if (tr)
+                return r = _pol2log[ _characteristic - (unsigned long long)tr ];
+            else
+                return r = zero;
+        } else {
+            if (tr >= (long long)_characteristic ) tr = (unsigned long long)tr % _characteristic ;
+            return r = _pol2log[ tr ];
+        }
+    }
+
+
+    template<typename TT>
+    inline unsigned long long& GFqDom<TT>::convert (unsigned long long& r, const Rep a) const
+    {
+        return r = (unsigned long long)_log2pol[ (unsigned long)a] ;
+    }
+    template<typename TT>
+    inline long long& GFqDom<TT>::convert (long long& r, const Rep a) const
+    {
+        return r = (long long)_log2pol[ (unsigned long)a] ;
+    }
 
+#endif
 
 
+    template<typename TT>
+    inline double& GFqDom<TT>::convert (double& r, const Rep a) const
+    {
+        return r = (double)_log2pol[ (UT)a] ;
+    }
+
+    template<typename TT>
+    inline float& GFqDom<TT>::convert (float& r, const Rep a) const
+    {
+        return r = (float)_log2pol[ (UT)a] ;
+    }
+
+    template<typename TT>
+    inline std::ostream& GFqDom<TT>::write (std::ostream& o, const Rep a) const
+    {
+        return o << _log2pol[ (UT)a] ;
+    }
+
+
+
+    template<typename TT>
+    inline long& GFqDom<TT>::convert (long& r, const Rep a) const
+    {
+        return r = (long)_log2pol[ (unsigned long)a] ;
+    }
+
+    template<typename TT>
+    inline unsigned long& GFqDom<TT>::convert (unsigned long& r, const Rep a) const
+    {
+        return r = (unsigned long)_log2pol[ (unsigned long)a] ;
+    }
+
+    template<typename TT>
+    inline int& GFqDom<TT>::convert (int& r, const Rep a) const
+    {
+        return r = (int)_log2pol[ (UT)a] ;
+    }
+
+    template<typename TT>
+    inline unsigned int& GFqDom<TT>::convert (unsigned int& r, const Rep a) const
+    {
+        return r = (unsigned int)_log2pol[ (UT)a] ;
+    }
+
+    template<typename TT>
+    inline TT GFqDom<TT>::convert (const Rep a) const
+    {
+        return (TT)_log2pol[ (UT)a] ;
+    }
+
+    template<typename TT>
+    inline Integer& GFqDom<TT>::convert (Integer& r, const Rep a) const
+    {
+        return r = (Integer)_log2pol[ (UT)a] ;
+    }
+
+
+        // ---------
+        // -- Initialization operations
+        // ---------
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r) const
+    { return r = zero; }
+
+
+    template<typename TT>
+    template<typename val_t, template<class, class> class Vector, template <class> class Alloc>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::init( Rep& r, const Vector<val_t, Alloc<val_t> >& P) {
+        static Self_t PrimeField(this->_characteristic);
+        typedef Poly1Dom< Self_t, Dense > PolDom;
+        static PolDom Pdom( PrimeField );
+        typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
+        static PadicDom PAD(Pdom);
+        Degree d;  Pdom.degree(d, P);
+        if (d >= (long)this->_exponent) {
+            static typename PadicDom::Element tmp;
+            static typename PadicDom::Element Irreducible = PAD.radix(tmp, this->_irred);
+                // All this was to get the irreducible polynomial
+                // Now we can mod it out
+            typename PolDom::Element modP; Pdom.mod(modP, P, Irreducible);
+            TT tr;
+            PAD.eval(tr, modP);
+            return r = (Rep) this->_pol2log[(size_t) tr ];
+        } else {
+            TT tr;
+            PAD.eval(tr, P);
+            return r = (Rep) this->_pol2log[ (size_t)tr ];
+        }
+    }
+
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::assign( Rep& r, const Integer a) const
+    { return init (r, a); }
+
+    template<typename TT>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::assign( Rep& r, const Rep a) const
+    { return r = a; }
+
+
+    template<typename TT> inline void GFqDom<TT>::assign( const size_t sz, Array r, constArray a ) const
+    {
+        TT tr;
+            //    for ( size_t i=sz ; --i ; )
+        for ( size_t i=sz; i--;) {
+            tr = a[i] ;
+            if (tr <0) {
+                    // -a = b [p]
+                    // a = p-b [p]
+                tr = -tr;
+                if (tr >=_characteristic ) tr = tr % _characteristic ;
+                if (tr)
+                    r[i] = _pol2log[ _characteristic - tr ];
+                else
+                    r[i] = 0;
+            } else {
+                if (tr >=_characteristic ) tr = tr % _characteristic ;
+                r[i] = _pol2log[ tr ];
+            }
+        }
+    }
+
+    template<typename TT>
+    inline typename  GFqDom<TT>::Rep& GFqDom<TT>::dotprod
+    ( Rep& r, const size_t sz, constArray a, constArray b ) const
+    {
+        if (sz) {
+            _GIVARO_GFQ_MUL(r,a[0],b[0],_qm1);
+            Rep tmp;
+            for(  int i= (int)sz; --i; ) {
+                _GIVARO_GFQ_MUL(tmp,a[i],b[i],_qm1);
+                _GIVARO_GFQ_ADD(r,r,tmp,_qm1,_plus1);
+            }
+            return r;
+        } else
+            return r = zero;
+    }
+
+
+        // ----- random generators
+    template<typename TT> template<typename RandIter> inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& a) const
+    {
+            //     do
+            //         a = Rep( (UTT)(lrand48()) % _q);
+            //     while (isZero(a));
+            //     a = (a<0?a+_q:a);
+            //     return a;
+        a = Rep( ((UTT)(g()) % (_q-1)) + 1);
+        return a = (a<0?a+(Rep)_q:a);
+
+    }
+
+    template<typename TT> template<typename RandIter> inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& a) const
+    {
+        a = Rep( (UTT)(g()) % _q);
+        return a = (a<0?a+(Rep)_q:a);
+    }
+
+    template<typename TT> template<typename RandIter>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& r, long s) const
+    {
+        return random(g,r);
+    }
+
+
+    template<typename TT> template<typename RandIter>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::random(RandIter& g, Rep& r, const Rep& b) const
+    {
+        return random(g,r);
+    }
+
+    template<typename TT> template<typename RandIter>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& r, long s) const
+    {
+        return nonzerorandom(g,r);
+    }
+
+    template<typename TT> template<typename RandIter>
+    inline typename GFqDom<TT>::Rep& GFqDom<TT>::nonzerorandom(RandIter& g, Rep& r, const Rep& b) const
+    {
+        return nonzerorandom(g,r);
+    }
+
+
+
+
+    template<typename TT>
+    inline GFqDom<TT>::GFqDom(const UTT P, const UTT e)
+            // Precondition P prime
+            :  zero(0)
+        , one ( (TT)power(P,e) - 1  )
+        , _characteristic(P)
+        , _exponent(e)
+        , _q( (UTT) one + 1 )
+        , _qm1 ( (UTT) one )
+        , _qm1o2(  (P==2)?  ((UTT)one)  :  (_q >> 1) )   // 1 == -1 in GF(2^k)
+        , mOne((TT)_qm1o2)
+        , _log2pol((UT) _q )
+        , _pol2log( (UT)_q )
+        , _plus1( (UT)_q )
+        , _dcharacteristic( (double)P )
+    {
+
+            // 1 is represented by q-1, zero by 0
+        _log2pol[0] = (UTT) zero;
+
+        if (e <= 1) {
+            IntNumTheoDom<> NTD;
+            IntNumTheoDom<>::Rep IP(P), pr;
+                //         UTT seed = (UTT) ( NTD.Integer2long( NTD.lowest_prim_root(pr, IP) ) );
+            UTT seed;
+            NTD.convert(seed, NTD.lowest_prim_root(pr, IP) );
+            UTT accu = 1;
+            for(UTT i=1; i<P; i++) {
+                accu = (accu * seed) % P;
+                _log2pol[(UT)i] = accu;
+            }
+        } else {
+                // Fisrt compute an irreductible polynomial F over Z/pZ of degree e
+                // Then a primitive root G (i.e. a generator of GF(q))
+            GFqDom<TT> Zp(P,1);
+                //         typedef CyclotomicTable<  GFqDom<TT>, Dense > PolDom;
+                //         PolDom Pdom( Zp, e );
+            typedef Poly1FactorDom< Self_t, Dense > PolDom;
+            PolDom Pdom( Zp );
+            typename PolDom::Element F, G, H;
+
+                // F is irreducible of degree e over Zp
+                // G is a primitive polynomial for F
+                //         Pdom.random_prim_root(F,G, Degree(e));
+
+                // F is an irreducible factor of the
+                // (p^e-1) th cyclotomic polynomial
+                // G is a primitive polynomial for F : X
+                //         Pdom.getcyclo(F);
+                //         Pdom.init(G, Degree(1), Zp.one);
+
+                // F is irreducible of degree e over Zp
+                // with X as a primitive polynomial
+#ifndef GIVARO_RANDOM_IRREDUCTIBLE_PRIMITIVE_ROOT
+            Pdom.ixe_irreducible(F, Degree((long)e));
+                //         Pdom.init(G, Degree(1), Zp.one);
+                //         Pdom.assign(G, Degree(1), Zp.one);
+            Pdom.init(G, Degree(1));
+#else
+            Pdom.random_irreducible(F, Degree((long)e));
+            Pdom.give_random_prim_root(G,F);
+#endif
 
-				template<typename TT> inline void GFqDom<TT>::Init() {}
-
-				template<typename TT> inline void GFqDom<TT>::End() {}
+            Pdom.assign(H, G);
+
+            typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
+            PadicDom PAD(Pdom);
+
+            PAD.eval(_log2pol[1], H);
+            PAD.eval(_irred, F);
+
+            for (UTT i = 2; i < _qm1; ++i) {
+                Pdom.mulin(H, G);
+                Pdom.modin(H, F);
+                PAD.eval(_log2pol[(UT)i], H);
+            }
+
+            _log2pol[(UT)_qm1] = 1;
+
+        }
+
+        _log2pol[0] = 0;
+
+            // pol2log[ j ] = i such that log2pol[i] = j
+        for (UTT i = 0; i < _q; ++i)
+            _pol2log[ (UT)_log2pol[(UT)i] ] = i;
+
+            // plus1[i] = k such that G^i + 1 = G^k
+            // WARNING : in the plus1 table, we now pre-substract (_q - 1)
+        _plus1[0] = 0;
+
+        UTT a,b,r;
+        for (UTT i = 1; i < _q; ++i) {
+            a = _log2pol[(UT)i];
+            r = a % P;
+            if (r == (P - 1))
+                b = a - r;
+            else
+                b = a + 1;
+                // WARNING : in the plus1 table we pre-substract (_q - 1)
+            _plus1[(UT)i] = (TT)(_pol2log[(UT)b] - _qm1);
+        }
+            // -1 + 1 == 0
+        _plus1[(UT)_qm1o2] = 0;
+    }
+
+        // Dan Roche 6-15-04, adapted my/ported back to Givaro
+        // by Martin Albrecht 10-06-06
+        // This constructor takes a vector of ints that represent the polynomial
+        // to use (for modular arithmetic on the extension field).
+    template<typename TT>
+    template<typename Vector>
+    inline GFqDom<TT>::GFqDom(const UTT P, const UTT e, const Vector& modPoly):
+            zero(0)
+        , one ((TT) power(P,e) - 1  )
+        , _characteristic(P)
+        , _exponent(e)
+        , _q( (UTT) one + 1 )
+        , _qm1 ( (UTT)one )
+        , _qm1o2(  (P==2)?  ((UTT)one)  :  (_q >> 1) )   // 1 == -1 in GF(2^k)
+        , mOne((TT)_qm1o2)
+        , _log2pol( (UT)_q )
+        , _pol2log( (UT)_q )
+        , _plus1( (UT)_q )
+        , _dcharacteristic( (double)P )
+    {
+
+            // 1 is represented by q-1, zero by 0
+        _log2pol[0] = (UTT)zero;
+
+        GFqDom<TT> Zp(P,1);
+        typedef Poly1FactorDom< GFqDom<TT>, Dense > PolDom;
+        PolDom Pdom( Zp );
+        typename PolDom::Element Ft, F(e+1), G, H;
+
+        for( size_t i = 0; i < F.size(); ++i )
+            Zp.init( F[i], modPoly[i]);
+
+        Pdom.give_prim_root(G,F);
+        Pdom.assign(H,G);
+
+        typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
+        PadicDom PAD(Pdom);
+
+        PAD.eval(_log2pol[1],H);
+        PAD.eval(_irred, F);
+
+        for (UTT i = 2; i < _qm1; ++i) {
+            Pdom.mulin(H, G);
+            Pdom.modin(H, F);
+            PAD.eval(_log2pol[i], H);
+        }
+        _log2pol[_qm1] = 1;
+
+        _log2pol[0] = 0;
+
+        for (UTT i = 0; i < _q; ++i)
+            _pol2log[ _log2pol[i] ] = i;
+
+        _plus1[0] = 0;
+
+        UTT a,b,r;
+        for (UTT i = 1; i < _q; ++i) {
+            a = _log2pol[i];
+            r = a % P;
+            if (r == (P - 1))
+                b = a - r;
+            else
+                b = a + 1;
+            _plus1[i] = (TT)_pol2log[b] - (TT)_qm1;
+        }
+
+        _plus1[_qm1o2] = 0;
+    }
+
+
+    template<typename TT> inline void GFqDom<TT>::Init() {}
+
+    template<typename TT> inline void GFqDom<TT>::End() {}
 
 
 #ifdef __GIVARO_COUNT__
-				template<typename TT> long long GFqDom<TT>::_mul_count = 0;
-				template<typename TT> long long GFqDom<TT>::_add_count = 0;
-				template<typename TT> long long GFqDom<TT>::_div_count = 0;
-				template<typename TT> long long GFqDom<TT>::_sub_count = 0;
-				template<typename TT> long long GFqDom<TT>::_neg_count = 0;
-				template<typename TT> long long GFqDom<TT>::_inv_count = 0;
-				template<typename TT> long long GFqDom<TT>::_mul_call = 0;
-				template<typename TT> long long GFqDom<TT>::_add_call = 0;
-				template<typename TT> long long GFqDom<TT>::_div_call = 0;
-				template<typename TT> long long GFqDom<TT>::_sub_call = 0;
-				template<typename TT> long long GFqDom<TT>::_neg_call = 0;
-				template<typename TT> long long GFqDom<TT>::_inv_call = 0;
+    template<typename TT> long long GFqDom<TT>::_mul_count = 0;
+    template<typename TT> long long GFqDom<TT>::_add_count = 0;
+    template<typename TT> long long GFqDom<TT>::_div_count = 0;
+    template<typename TT> long long GFqDom<TT>::_sub_count = 0;
+    template<typename TT> long long GFqDom<TT>::_neg_count = 0;
+    template<typename TT> long long GFqDom<TT>::_inv_count = 0;
+    template<typename TT> long long GFqDom<TT>::_mul_call = 0;
+    template<typename TT> long long GFqDom<TT>::_add_call = 0;
+    template<typename TT> long long GFqDom<TT>::_div_call = 0;
+    template<typename TT> long long GFqDom<TT>::_sub_call = 0;
+    template<typename TT> long long GFqDom<TT>::_neg_call = 0;
+    template<typename TT> long long GFqDom<TT>::_inv_call = 0;
 #endif
 
 } // namespace Givaro
 
 #endif // __GIVARO_gfq_INL
-// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+// vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/zpz/givgfqext.h b/src/kernel/zpz/givgfqext.h
index ed14c17..daf3d6b 100644
--- a/src/kernel/zpz/givgfqext.h
+++ b/src/kernel/zpz/givgfqext.h
@@ -5,15 +5,18 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 // file: givgfqext.h
-// Time-stamp: <29 Sep 09 18:10:13 Jean-Guillaume.Dumas at imag.fr>
+// Time-stamp: <07 May 12 15:08:17 Jean-Guillaume.Dumas at imag.fr>
 // date: 2007
 // version:
 // author: Jean-Guillaume.Dumas
 
-/*! @brief   Arithmetic on GF(p^k), with p a prime number less than 2^15.
+/*! @file givgfqext.h
+ * @ingroup zpz
+ * @brief   Arithmetic on GF(p^k), with p a prime number less than 2^15.
  *   Specialized for fast conversions to floating point numbers.
  *  Main difference in interface is init/convert.
- * @bib  [JG Dumas, Q-adic Transform Revisited, ISSAC 2008]
+ * @bib
+ * - JG Dumas, <i>Q-adic Transform Revisited</i>, ISSAC 2008
  *  @warning k strictly greater than 1
  */
 
@@ -35,6 +38,7 @@ namespace Givaro {
 	template<class TT> class GFqExt;
 
 
+	//! GFq Ext
 	template<class TT> class GFqExtFast : public GFqDom<TT> {
 	protected:
 		typedef typename Signed_Trait<TT>::unsigned_type UTT;
@@ -85,6 +89,21 @@ namespace Givaro {
 
 		}
 
+		// Extension MUST be a parameter of the constructor
+        template<typename Vector>
+		GFqExtFast( const UTT P, const UTT e, const Vector& modPoly) : Father_t(P,e, modPoly),
+		_BITS( std::numeric_limits< double >::digits/( (e<<1)-1) ),
+		_BASE(1 << _BITS),
+		_MASK( _BASE - 1),
+		_maxn( _BASE/(P-1)/(P-1)/e),
+		_degree( e-1 ),
+		balanced(false)
+		{
+			GIVARO_ASSERT(_maxn>0 , "[GFqExtFast]: field too large");
+			builddoubletables();
+
+		}
+
 		virtual ~GFqExtFast() {};
 
 		Self_t operator=( const Self_t& F)
@@ -121,21 +140,21 @@ namespace Givaro {
 		// Accesses
 
 		UTT bits() const
-{ return _BITS;}
+		{ return _BITS;}
 		UTT base() const
-{ return _BASE;}
+		{ return _BASE;}
 		UTT mask() const
-{ return _MASK;}
+		{ return _MASK;}
 		UTT maxdot() const
-{ return _maxn; }
+		{ return _maxn; }
 		UTT& characteristic(UTT& a) const
-{ return a=this->_characteristic; }
+		{ return a=this->_characteristic; }
 		UTT characteristic() const
-{ return this->_characteristic; }
+		{ return this->_characteristic; }
 		const bool balanced;
 
 		Rep& init( Rep& r, const unsigned long l) const
-{
+		{
 			return Father_t::init(r,l);
 		}
 
@@ -144,25 +163,28 @@ namespace Givaro {
 
 
 		virtual double& convert(double& d, const Rep a) const
-{
-			return d=_log2dbl[a];
+		{
+			return d=_log2dbl[(size_t)a];
 		}
 
 		virtual float& convert(float& d, const Rep a) const
-{
-			return d=(float)_log2dbl[a];
+		{
+			return d=(float)_log2dbl[(size_t)a];
 		}
 
 		virtual Rep& init(Rep& pad, const double d) const
-{
+		{
+			GIVARO_ASSERT(d>=0.0 , "[GFqExtFast]: init from a negative number");
+			GIVARO_ASSERT(d<_MODOUT, "[GFqExtFast]: init from a too large number");
 			// WARNING WARNING WARNING WARNING
 			// Precondition : 0 <= d < _MODOUT
 			// Can segfault if d is too large
 			// WARNING WARNING WARNING WARNING
-			unsigned __GIVARO_INT64 rll( static_cast<__GIVARO_INT64>(d) );
-			unsigned __GIVARO_INT64 tll( static_cast<__GIVARO_INT64>(d/this->_dcharacteristic) );
+			uint64_t rll( static_cast<uint64_t>(d) );
+			uint64_t tll( static_cast<uint64_t>(d/this->_dcharacteristic) );
 			UTT prec(0);
 			UTT padl = (UTT)(rll - tll*this->_characteristic);
+  
 			if (padl == this->_characteristic) {
 				padl -= this->_characteristic;
 				tll += 1;
@@ -176,7 +198,7 @@ namespace Givaro {
 				padl ^= prec;
 			}
 
-			pad = prec;
+			pad = (Rep)prec;
 			for(size_t j = 0;j<_degree;++j) {
 				rll >>= _BITS;
 				tll >>= _BITS;
@@ -186,17 +208,20 @@ namespace Givaro {
 				pad ^= prec;
 			}
 
-			padl = this->_low2log[padl];
-			pad = this->_high2log[pad];
-			return this->addin(pad,padl);
+			padl = this->_low2log[(size_t)padl];
+			pad = (Rep)this->_high2log[(size_t)pad];
+			return this->addin(pad,(Rep)padl);
 		}
 
 		virtual Rep& init(Rep& pad, const float d) const
-{
+		{
 			return init(pad, (double)d);
 		}
 
 
+		template<class RandIter> Rep& random(RandIter& g, Rep& r) const {
+			return init(r, static_cast<double>( (UTT)g() % _MODOUT));
+		}
 
 
 	protected:
@@ -221,7 +246,7 @@ namespace Givaro {
 
 			Element xkmu;
 			// This is X
-			xkmu = this->_pol2log[this->_characteristic];
+			xkmu = (Element)this->_pol2log[(size_t)this->_characteristic];
 			// This is X^{e-1}
 			dom_power(xkmu,xkmu,this->_exponent-1,*this);
 
@@ -269,18 +294,18 @@ namespace Givaro {
 				}
 
 				PAD.eval(tmp , low_ui );
-				_low2log[binpolit] = this->_pol2log[tmp];
+				_low2log[binpolit] = this->_pol2log[(size_t)tmp];
 
 				low_ui.push_back(cour);
 				PAD.eval( tmp, low_ui);
-				Father_t::mul((Element&)_high2log[binpolit],(Element)this->_pol2log[tmp], xkmu);
+				Father_t::mul((Element&)_high2log[(size_t)binpolit],(Element)this->_pol2log[(size_t)tmp], xkmu);
 			}
 		}
 	};
 
 
 
-
+	//! GFq Ext (other)
 	template<class TT> class GFqExt : public GFqExtFast<TT> {
 	protected:
 		typedef typename Signed_Trait<TT>::unsigned_type UTT;
@@ -317,7 +342,7 @@ namespace Givaro {
 		using Father_t::init;
 
 		virtual Rep& init(Rep& pad, const double d) const
-{
+		{
 			// Defensive init
 			const double tmp(fmod(d,this->_fMODOUT));
 			return DirectFather_t::init(pad, (tmp>0.0)?tmp:(tmp+_fMODOUT) );
diff --git a/src/kernel/zpz/givgfqkron.h b/src/kernel/zpz/givgfqkron.h
index 7ccfb80..c4ef1d7 100644
--- a/src/kernel/zpz/givgfqkron.h
+++ b/src/kernel/zpz/givgfqkron.h
@@ -10,7 +10,7 @@
 // version:
 // author: Jean-Guillaume.Dumas
 
-/*! @file zpz/givgfqkron.h
+/*! @file givgfqkron.h
  * @ingroup zpz
  * @brief  Arithmetic on GF(p^k), with dynamic Kronecker substitution.
  * @pre  k(p-1)^2 < word size
@@ -19,6 +19,8 @@
 #ifndef __GIVARO_gfq_kronecker_H
 #define __GIVARO_gfq_kronecker_H
 
+#include "givaro/givzpz.h"
+#include "givaro/givzpzInt.h"
 #include "givaro/givgfq.h"
 #include "givaro/givpower.h"
 #include <limits>
@@ -27,6 +29,7 @@
 
 namespace Givaro {
 
+	//! GFqKronecker
 template<class TT, class Ints> struct GFqKronecker : public GFqDom<TT> {
 protected:
     typedef typename Signed_Trait<TT>::unsigned_type UTT;
@@ -52,6 +55,16 @@ public:
         setShift(std::numeric_limits<UTT>::digits/( (e<<1)-1) );
     }
 
+    Ints getMaxn() const {
+	return _sMAXN;
+    }
+    UTT getShift() const {
+	return _SHIFTS;
+    }
+    UTT getBase() const {
+	return _sBASE;
+    }
+
         // Set shifts, returns maxn
     Ints setShift(const Ints& i) {
         _SHIFTS=i;
@@ -181,8 +194,8 @@ protected:
     UTT _SHIFTS;
     Ints _sBASE,_sMASK,_sMAXN;
 
-    Ints _epmunsq;
     UTT _pceil,_pMASK,_degree;
+    Ints _epmunsq;
 
     std::vector<UTT> _log2bin;
     std::vector<UTT> _bin2log;
diff --git a/src/kernel/zpz/givmontg32.C b/src/kernel/zpz/givmontg32.C
index 32f4e1a..101dc93 100644
--- a/src/kernel/zpz/givmontg32.C
+++ b/src/kernel/zpz/givmontg32.C
@@ -10,6 +10,9 @@
 // ==========================================================================
 // Description:
 
+#ifndef __GIVARO_zpz_givmontg32_C
+#define __GIVARO_zpz_givmontg32_C
+
 #include <iostream>
 #include "givaro/givmontg32.h"
 namespace Givaro {
@@ -75,3 +78,5 @@ void Montgomery<Std32>::End()
 {
 }
 } // namespace Givaro
+
+#endif
diff --git a/src/kernel/zpz/givmontg32.h b/src/kernel/zpz/givmontg32.h
index a73c35b..eec77b4 100644
--- a/src/kernel/zpz/givmontg32.h
+++ b/src/kernel/zpz/givmontg32.h
@@ -8,7 +8,7 @@
 // $Id: givmontg32.h,v 1.15 2011-02-04 14:11:46 jgdumas Exp $
 // ==========================================================================
 
-/*! @file zpz/givmontg32.h
+/*! @file givmontg32.h
  * @ingroup zpz
  * @brief NO DOC
  */
@@ -49,21 +49,22 @@ namespace Givaro {
 		typedef uint32_t Element;
 
 		// ----- Constructor
-		Montgomery() : _p(0UL), _dp(0.0), zero(0UL), one(1UL) {}
+		Montgomery() : _p(0UL), _dp(0.0), zero(0UL), one(1UL), mOne(_p-one) {}
 
 		Montgomery( Residu_t p, int = 1) :
 			_p(  (Residu_t)  p),
 			_Bp( (Residu_t)  B32%p),
 			_B2p((Residu_t)  (_Bp<<HALF_BITS32) % p),
 			_B3p((Residu_t)  (_B2p<<HALF_BITS32) % p),
-			_nim((Residu_t)  -Montgomery<Std32>::invext(_p,B32) ),
+			_nim((Residu_t)  -Montgomery<Std32>::invext((int32_t)_p,B32) ),
 			_dp( (double)    p),
 			zero((Residu_t)  0UL),
-			one( (Residu_t)  redcsal( _B2p ) )
+			one( (Residu_t)  redcsal( _B2p ) ),
+			mOne( _p - one )
 		{}
 
 		Montgomery( const Montgomery<Std32>& F)
-		: _p(F._p), _Bp(F._Bp), _B2p( F._B2p), _B3p( F._B3p), _nim(F._nim),_dp(F._dp), zero(0UL), one(F.one)
+		: _p(F._p), _Bp(F._Bp), _B2p( F._B2p), _B3p( F._B3p), _nim(F._nim),_dp(F._dp), zero(0UL), one(F.one),mOne(F.mOne)
 		{ }
 
 
@@ -80,6 +81,9 @@ namespace Givaro {
 			this->_B3p = F._B3p;
 			this->_nim = F._nim;
 			this->_dp = F._dp;
+			assign(const_cast<Element&>(one),F.one);
+			assign(const_cast<Element&>(mOne),F.mOne);
+			assign(const_cast<Element&>(zero),F.zero);
 			return *this;
 		}
 
@@ -239,6 +243,7 @@ namespace Givaro {
 					// ----- Constantes
 					const Rep zero;
 					const Rep one;
+					const Rep mOne;
 	};
 
 
diff --git a/src/kernel/zpz/givmontg32.inl b/src/kernel/zpz/givmontg32.inl
index 906e743..9bb33c2 100644
--- a/src/kernel/zpz/givmontg32.inl
+++ b/src/kernel/zpz/givmontg32.inl
@@ -271,10 +271,10 @@ inline  Montgomery<Std32>::Rep&  Montgomery<Std32>::init ( Rep& r, const long a
   if (a <0)
   {
 	  sign =-1;
-	  ua = -a;
+	  ua = (unsigned long) -a;
   }
   else {
-	  ua = a;
+	  ua = (unsigned long)a;
 	  sign =1;
   }
   r =Rep ( ua >= (uint32_t)_p ? ua % (uint32_t)_p : ua);
@@ -400,8 +400,9 @@ inline std::ostream& Montgomery<Std32>::write (std::ostream& s ) const
 
 inline std::istream& Montgomery<Std32>::read (std::istream& s, Rep& a) const
 {
-  s >> a;
-  init(a, a);
+  Integer tmp;
+  s >> tmp;
+  init(a, tmp);
   return s;
 }
 
diff --git a/src/kernel/zpz/givprimes16.h b/src/kernel/zpz/givprimes16.h
index 02ef0b2..ba2e965 100644
--- a/src/kernel/zpz/givprimes16.h
+++ b/src/kernel/zpz/givprimes16.h
@@ -9,7 +9,7 @@
 // Time-stamp: <02 Oct 07 16:43:17 Jean-Guillaume.Dumas at imag.fr>
 // ==========================================================================
 
-/*! @file zpz/givprimes16.h
+/*! @file givprimes16.h
  * @ingroup zpz
  * @brief  set of primes less than 2^16
  */
@@ -19,7 +19,7 @@
 
 #include <stddef.h>
 namespace Givaro {
-  // ---------------------------------------------  class Primes16
+  //! class Primes16
 class Primes16  {
 public:
 
diff --git a/src/kernel/zpz/givrns.h b/src/kernel/zpz/givrns.h
index 4c59152..6a20edd 100644
--- a/src/kernel/zpz/givrns.h
+++ b/src/kernel/zpz/givrns.h
@@ -9,7 +9,7 @@
 // $Id: givrns.h,v 1.5 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*! @file zpz/givrns.h
+/*! @file givrns.h
  * @ingroup zpz
  * @brief  Modular arithmetic for GIVARO.
  * Here is defined arithmetic functions
@@ -36,7 +36,6 @@ namespace Givaro {
 	 * - operator += (Ring&, const Modulo&)
 	 * .
 	 */
-
 	template<class RING, class Domain>
 	class RNSsystem  {
 		typedef RNSsystem<RING, Domain> Self_t;
diff --git a/src/kernel/zpz/givrnsconvert.inl b/src/kernel/zpz/givrnsconvert.inl
index 738d393..17bcfa1 100644
--- a/src/kernel/zpz/givrnsconvert.inl
+++ b/src/kernel/zpz/givrnsconvert.inl
@@ -22,7 +22,7 @@ void RNSsystem<RING,Domain>::RnsToMixedRadix
 {
   int j;
   int i=0,Size = (int)_primes.size();
-  if ((int)mixrad.size() < Size) mixrad.reallocate( Size );
+  if ((int)mixrad.size() < Size) mixrad.reallocate( (size_t)Size );
 
   // -- Computation of  Ck
   if (_ck.size()==0) ((RNSsystem*)this)->ComputeCk();
@@ -84,7 +84,7 @@ template<class RING, class Domain>
 void RNSsystem<RING,Domain>::RingToRns( RNSsystem<RING,Domain>::array& rns , const RING& a) const
 {
   int Size = (int) _primes.size();
-  if ((int)rns.size() != Size) rns.reallocate(Size);
+  if ((int)rns.size() != Size) rns.reallocate((size_t)Size);
   // -- may be faster using the recursive
   // tree algorithm a mod p_1...p_k/2, and a mod p_k/2+1...p_k
   for (int i=0; i<Size; i++)
diff --git a/src/kernel/zpz/givrnscstor.inl b/src/kernel/zpz/givrnscstor.inl
index 8160713..27da05d 100644
--- a/src/kernel/zpz/givrnscstor.inl
+++ b/src/kernel/zpz/givrnscstor.inl
@@ -27,13 +27,14 @@ namespace Givaro {
 	{}
 
 	template<class RING, class Domain>
-	RNSsystem<RING,Domain>::RNSsystem (const RNSsystem<RING,Domain>& R)
+	RNSsystem<RING,Domain>::RNSsystem (const Self_t & R)
 	: _primes(R._primes, givWithCopy()),
 	_ck(R._ck, givWithCopy())
 	{}
 
 	template<class RING, class Domain>
-	void RNSsystem<RING,Domain>::setPrimes (const RNSsystem<RING,Domain>::domains& inprimes) {
+	void RNSsystem<RING,Domain>::setPrimes (const domains& inprimes)
+	{
 		_primes.allocate(0);
 		_primes.copy( inprimes );
 		_ck.reallocate(0);
@@ -41,7 +42,7 @@ namespace Givaro {
 
 	// -- Array of primes are given
 	template<class RING, class Domain>
-	RNSsystem<RING,Domain>::RNSsystem( const RNSsystem<RING,Domain>::domains& inprimes)
+	RNSsystem<RING,Domain>::RNSsystem( const domains& inprimes)
 	: _primes(inprimes, givWithCopy()),
 	_ck(0)
 	{
@@ -57,7 +58,7 @@ namespace Givaro {
 
 		// - reallocation of a new array :
 		int Size = (int) _primes.size();
-		_ck.reallocate(Size);
+		_ck.reallocate((size_t)Size);
 		//  _ck[0] = Neutral::zero; // -- undefined and never used
 
 		for (int k=1; k < Size; ++k)
diff --git a/src/kernel/zpz/givrnsfixed.h b/src/kernel/zpz/givrnsfixed.h
index cef1cd9..3d030d8 100644
--- a/src/kernel/zpz/givrnsfixed.h
+++ b/src/kernel/zpz/givrnsfixed.h
@@ -6,7 +6,7 @@
 // Time-stamp: <01 Apr 11 15:43:07 Jean-Guillaume.Dumas at imag.fr>
 // ==========================================================================
 
-/*! @file zpz/givrnsfixed.h
+/*! @file givrnsfixed.h
  * @ingroup zpz
  * @brief Chinese Remainder Algorithm.
  */
diff --git a/src/kernel/zpz/givrnsfixed.inl b/src/kernel/zpz/givrnsfixed.inl
index 1337cc4..15a7713 100644
--- a/src/kernel/zpz/givrnsfixed.inl
+++ b/src/kernel/zpz/givrnsfixed.inl
@@ -26,12 +26,12 @@ namespace Givaro {
 			RnsToRingRight(I, residues, lowerlevel, lowercolnext);
 
 			I -= u0; 				// u1-u0
-			I *= _primes[lowerlevel][lowercolnext];	// (u1-u0) * (p0(p0^{-1} mod p1))
+			I *= _primes[(size_t)lowerlevel][(size_t)lowercolnext];	// (u1-u0) * (p0(p0^{-1} mod p1))
 			I += u0;				// (u1-u0)*M01+u0
-			return Integer::modin(I, _primes[level][col]);// (u1-u0)*M01 +u0 mod p0p1, between 0 and p0p1-1
+			return Integer::modin(I, _primes[(size_t)level][(size_t)col]);// (u1-u0)*M01 +u0 mod p0p1, between 0 and p0p1-1
 		}
 		else {
-			return I=residues[col];
+			return I=residues[(size_t)col];
 		}
 	}
 
@@ -47,10 +47,10 @@ namespace Givaro {
 			RnsToRingRight(I, residues, lowerlevel, lowercolnext);
 
 			I -= u0; 				// u1-u0
-			I *= _primes[lowerlevel][lowercolnext];	// (u1-u0) * (p0(p0^{-1} mod p1))
+			I *= _primes[(size_t)lowerlevel][(size_t)lowercolnext];	// (u1-u0) * (p0(p0^{-1} mod p1))
 			return I += u0;				// (u1-u0)*M01+u0
 		} else {
-			return I=residues[col];
+			return I=residues[(size_t)col];
 		}
 	}
 
@@ -62,9 +62,9 @@ namespace Givaro {
 	Ints& RNSsystemFixed<Ints>::RnsToRing( Ints& I, const smallIntVector& rns)
 	{
 		int ir = (int)_RNS.Primes().size();
-		typename RNS_t::array Reds( ir );
+		typename RNS_t::array Reds( (size_t)ir );
 		for(int i = (int)_primes.size(); i-- ;) {
-			int is = (int)_primes[i].size();
+			int is = (int)_primes[(size_t)i].size();
 			if (is & 1) {
 				RnsToRingLeft(Reds[--ir], rns, i, --is);
 			}
@@ -85,14 +85,14 @@ namespace Givaro {
 	{}
 
 	template<class Ints>
-	RNSsystemFixed<Ints>::RNSsystemFixed (const RNSsystemFixed<Ints>& R) :
+	RNSsystemFixed<Ints>::RNSsystemFixed (const Self_t& R) :
 		_primes(R._primes, givWithCopy())
 	{}
 
 
 	// -- Array of primes are given
 	template<class Ints>
-	RNSsystemFixed<Ints>::RNSsystemFixed( const RNSsystemFixed<Ints>::array& inprimes) : _primes(0)
+	RNSsystemFixed<Ints>::RNSsystemFixed( const array& inprimes) : _primes(0)
 	{
 		GIVARO_ASSERT( inprimes.size()>0, "[RNSsystemFixed<Ints>::RNSsystemFixed] bad size of array");
 		_primes.reserve( GIVINTLOG(inprimes.size()) );
@@ -101,13 +101,13 @@ namespace Givaro {
 		for(typename array::const_iterator pit = inprimes.begin(); pit != inprimes.end(); ++pit) {
 			_primes.front().push_back( *pit );
 			for(int i = 1; i< (int)_primes.size(); ++i) {
-				int s = (int)_primes[i-1].size();
+				int s = (int)_primes[(size_t)i-1].size();
 				if (s & 1) break;
 				else {
-					Ints& p0(_primes[i-1][s-2]), & p1(_primes[i-1][s-1]);
+					Ints& p0(_primes[(size_t)i-1][(size_t)s-2]), & p1(_primes[(size_t)i-1][(size_t)s-1]);
 					Ints prod(p0*p1);
 					inv(p1, p0, p1) *= p0;
-					_primes[i].push_back( prod );
+					_primes[(size_t)i].push_back( prod );
 				}
 			}
 
@@ -126,7 +126,7 @@ namespace Givaro {
 
 				int s = (int)_primes.back().size();
 
-				Ints& p0(_primes[lastp][s-2]), & p1(_primes[lastp][s-1]);
+				Ints& p0(_primes[(size_t)lastp][(size_t)s-2]), & p1(_primes[(size_t)lastp][(size_t)s-1]);
 				newlevel.push_back( p0*p1  );
 
 				inv(p1, p0, p1) *= p0;
@@ -150,13 +150,13 @@ namespace Givaro {
 
 		int numodd=0;
 		for(int i = (int)_primes.size(); i-- ; )
-			if (_primes[i].size() & 1) ++numodd;
+			if (_primes[(size_t)i].size() & 1) ++numodd;
 
 
-		typename RNS_t::domains Mods(numodd);
+		typename RNS_t::domains Mods((size_t)numodd);
 		for(int i = (int)_primes.size(); i-- ; ) {
-			if (_primes[i].size() & 1)
-				Mods[--numodd] = _primes[i].back();
+			if (_primes[(size_t)i].size() & 1)
+				Mods[--numodd] = _primes[(size_t)i].back();
 		}
 		_RNS.setPrimes( Mods );
 	}
diff --git a/src/kernel/zpz/givtablelimits.h b/src/kernel/zpz/givtablelimits.h
index e1e1733..f3a4455 100644
--- a/src/kernel/zpz/givtablelimits.h
+++ b/src/kernel/zpz/givtablelimits.h
@@ -5,7 +5,7 @@
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
 // file: givadicqfq.h
-// Time-stamp: <11 Jun 07 19:18:31 Jean-Guillaume.Dumas at imag.fr>
+// Time-stamp: <30 Nov 11 11:12:05 Jean-Guillaume.Dumas at imag.fr>
 // date: 2007
 // version:
 // author: Jean-Guillaume.Dumas
@@ -16,7 +16,7 @@
  * Zech extension fitting a small enough memory space
  *   t-adic max sizes for BLAS based linear algebra over extension fields
  * @bib
- * -  [Dumas, Gautier, Pernet 2002] Finite field linear algebra subroutines.
+ * - Dumas, Gautier, Pernet  <i>Finite field linear algebra subroutines.</i>
  *  ISSAC'02: Proceedings of the 2002 International Symposium on Symbolic
  * and Algebraic Computation, Lille, France pp 63--74.
  */
@@ -25,13 +25,13 @@
 #define __GIVARO_tablesize_MAX_H
 
 
-#ifndef FF_TABLE_MAX
+#ifndef _GIVARO_FF_TABLE_MAX
 // 2^23 ---> 2^23*4*3 = 100K
 // #define FF_TABLE_MAX 8388608UL
 // 2^20 ---> 2s on 735MHz
 //#define FF_TABLE_MAX 1048576UL
 // Now 2^21+1 seems OK
-#define FF_TABLE_MAX 2097153UL
+#define _GIVARO_FF_TABLE_MAX 2097153UL
 #endif
 
 #ifndef _GIVARO_FF_MAXEXPONENT_
@@ -81,7 +81,7 @@ public:
         tmp *= double(P-1);
         tmp *= double(e);
         tmp *= double(nm);
-        size_t k = ilogb(tmp);
+        size_t k = (size_t)ilogb(tmp);
         return ( (53/(2*e-1))>k ? ++k : 0);
     }
 
diff --git a/src/kernel/zpz/givzpz.h b/src/kernel/zpz/givzpz.h
index 0f18bb8..7773287 100644
--- a/src/kernel/zpz/givzpz.h
+++ b/src/kernel/zpz/givzpz.h
@@ -9,7 +9,7 @@
 // $Id: givzpz.h,v 1.8 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*!@file zpz/givzpz.h
+/*!@file givzpz.h
  * @ingroup zpz
  * @brief   Family of arithmetics over Zpz (\f$\mathbf{Z}/p\mathbf{Z}\f$).
  */
@@ -23,11 +23,14 @@
 #include <givaro/givconfig.h>
 
 namespace Givaro {
-	template<class TAG> class ZpzDom;
+	template<class TAG>
+	class ZpzDom;
 }
 
 #include "givaro/givzpztypes.h"
 
+#include <givaro/givzpzGen.h>
+
 #include "givaro/givzpz16std.h"
 #include "givaro/givzpz16table1.h"
 
diff --git a/src/kernel/zpz/givzpz16std.C b/src/kernel/zpz/givzpz16std.C
index de5e403..8bb0575 100644
--- a/src/kernel/zpz/givzpz16std.C
+++ b/src/kernel/zpz/givzpz16std.C
@@ -10,6 +10,9 @@
 // ==========================================================================
 // Description:
 
+#ifndef __GIVARO_zpz_givzpz16std_C
+#define __GIVARO_zpz_givzpz16std_C
+
 #include <iostream>
 #include "givaro/givzpz16std.h"
 
@@ -73,4 +76,6 @@ namespace Givaro {
 
 } // namespace Givaro
 
+#endif
+
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/zpz/givzpz16std.h b/src/kernel/zpz/givzpz16std.h
index e1d9b12..bb08781 100644
--- a/src/kernel/zpz/givzpz16std.h
+++ b/src/kernel/zpz/givzpz16std.h
@@ -10,7 +10,7 @@
 // ==========================================================================
 //
 //  Modified by Pascal Giorgi on 2002/02/13  (pascal.giorgi at ens-lyon.fr)
-/*! @file zpz/givzpz16std.h
+/*! @file givzpz16std.h
  * @ingroup zpz
  * @brief   Arithmetic on Z/pZ, with p a prime number less than 2^14.
  *   Modulo typedef is a signed long number. In case it was modified
@@ -82,17 +82,27 @@ public:
 	// ----- Constantes
 	const Rep zero;
 	const Rep one;
+	const Rep mOne;
 
 	// ----- Constructor
-	ZpzDom() : zero(0), one(1), _p(0) {}
-	ZpzDom( Residu_t p ) : zero(0), one(1), _p(p) {}
-	ZpzDom( const ZpzDom<Std16>& F) : zero(0), one(1), _p(F._p) {}
+	ZpzDom() : zero(0), one(1), mOne(-1), _p(0) {}
+	ZpzDom( Residu_t p ) : zero(0), one(1), mOne(Rep(p-1)), _p(p) {}
+	ZpzDom( const ZpzDom<Std16>& F) : zero(F.zero), one(F.one), mOne(F.mOne), _p(F._p) {}
 
 
 	int operator==( const ZpzDom<Std16>& BC) const { return _p == BC._p;}
 	int operator!=( const ZpzDom<Std16>& BC) const { return _p != BC._p;}
 
-	ZpzDom<Std16>& operator=( const ZpzDom<Std16>& F) { this->_p = F._p; return *this;}
+	ZpzDom<Std16>& operator=( const ZpzDom<Std16>& F)
+	{
+
+		F.assign(const_cast<Element&>(one),F.one);
+		F.assign(const_cast<Element&>(zero),F.zero);
+		F.assign(const_cast<Element&>(mOne),F.mOne);
+
+		this->_p = F._p;
+		return *this;
+	}
 
 	// ----- Access to the modulus
 	Residu_t residu() const;
diff --git a/src/kernel/zpz/givzpz16std.inl b/src/kernel/zpz/givzpz16std.inl
index 290751f..a3a3b36 100644
--- a/src/kernel/zpz/givzpz16std.inl
+++ b/src/kernel/zpz/givzpz16std.inl
@@ -451,19 +451,19 @@ namespace Givaro {
 		unsigned int stride = 1;
 		if ((unsigned long)bound < GIVARO_MAXUINT16)
 			stride = (unsigned int) (GIVARO_MAXULONG/((unsigned long)bound * (unsigned long)bound));
-		unsigned long dot = zero;
+		unsigned long dot = (unsigned long)zero;
 		if ((sz <10) && (sz <stride)) {
 			for(  size_t i= sz; i--; )
-				dot += a[i] * b[i];
+				dot += (unsigned long)a[i] * (unsigned long)b[i];
 			if (dot > _p) r = (Rep)(dot % (uint16_t)_p);
 			else r = (Rep)dot;
 			return;
 		}
 		unsigned int i_begin=0;
-		stride &= ~0x1;
+		stride &= (unsigned int)~0x1;
 		if (stride ==0) {
 			for(  size_t i = sz; i--; ) {
-				dot += a[i] * b[i];
+				dot += (unsigned long)a[i] * (unsigned long)b[i];
 				if (dot>_p) dot %= _p;
 			}
 			r = (Rep)dot;
@@ -474,13 +474,13 @@ namespace Givaro {
 			if ((min_sz & 0x1) !=0) {
 				min_sz--;
 				i_begin++;
-				dot += a++[min_sz] * b++[min_sz];
+				dot += (unsigned long)a++[min_sz] * (unsigned long)b++[min_sz];
 			}
 			if (min_sz > 1)
 				for(  size_t i= min_sz; i>0; --i, --i, ++a, ++a, ++b, ++b )
 				{
-					dot += a[0] * b[0];
-					dot += a[1] * b[1];
+					dot += (unsigned long)a[0] * (unsigned long)b[0];
+					dot += (unsigned long)a[1] * (unsigned long)b[1];
 				}
 			if (dot>_p) dot %= (uint16_t)_p;
 			i_begin += (unsigned int) min_sz;
@@ -564,8 +564,9 @@ namespace Givaro {
 
 	inline std::istream& ZpzDom<Std16>::read (std::istream& s, Rep& a) const
 	{
-		s >> a;
-		init(a, a);
+        	Integer tmp;
+		s >> tmp;
+		init(a, tmp);
 		return s;
 	}
 
diff --git a/src/kernel/zpz/givzpz16table1.C b/src/kernel/zpz/givzpz16table1.C
index 673e088..514fd42 100644
--- a/src/kernel/zpz/givzpz16table1.C
+++ b/src/kernel/zpz/givzpz16table1.C
@@ -16,7 +16,7 @@
 namespace Givaro {
 
 ZpzDom<Log16>::ZpzDom( Residu_t p ) :
-       	zero(Rep(2*(p-1))), one(0), _p(p)
+	_p(p),_pmone(Residu_t(p-1)),zero(Rep(_pmone << 1)), one(0),mOne(Rep(_pmone>>1))
 {
 	int32_t i,j;
 
@@ -28,7 +28,6 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 	_tab_rep2value[0] = 1;
 	_tab_value2rep[1] = 0;
 
-	_pmone = Rep(_p -1);
 	int32_t fourp = ((int32_t)p) << 2, fourpmone= ((int32_t)_pmone)<<2;
 
 	int not_found = 1;
@@ -40,7 +39,7 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 	{
 		for(i=1; i<_p; i++)
 		{
-			accu = Rep((accu * seed) % _p);
+			accu = Residu_t((accu * seed) % _p);
 			//cout << i << " :: " << accu << endl;
 			_tab_rep2value[i] = accu;
 			if (accu == 1)
@@ -54,7 +53,7 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 		if (i ==_p-1) not_found = 0;
 		else {
 			do {
-				seed = Rep(rand() % _p);
+				seed = Residu_t(rand() % _p);
 			} while ((seed ==0) && (seed !=1));
 			//      if (seed < 0) seed += _p;
 		}
@@ -73,7 +72,7 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 	  }
 	  */
 	// -- Table for multiplication
-	_tab_mul = new Power_t[fourp];
+	_tab_mul = new Power_t[(size_t)fourp];
 	for(j=0; j<_pmone; j++)
 		_tab_mul[j] = (Rep)j;
 	for(j=_pmone; j< (int32_t)zero; j++)
@@ -86,7 +85,7 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 	_tab_neg = &_tab_mul[_pmone/2];
 
 	// -- Table for 1+value
-	_tab_pone = new Power_t[fourp];
+	_tab_pone = new Power_t[(size_t)fourp];
 	_tab_addone = &_tab_pone[(int32_t)(zero)];
 
 	/* Pascal Giorgi 24/04/02
@@ -122,7 +121,7 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 
 
 	// -- Table for 1-value
-	_tab_mone = new Power_t[fourp];
+	_tab_mone = new Power_t[(size_t)fourp];
 	_tab_subone = &_tab_mone[(int32_t)zero];
 
 	for(j=_pmone; j<=(int32_t)zero; j++)
@@ -148,21 +147,22 @@ ZpzDom<Log16>::ZpzDom( Residu_t p ) :
 	// -- temporary
 }
 
-ZpzDom<Log16>::ZpzDom(const ZpzDom<Log16>& F)
-  : zero(F.zero), one(F.one)
+ZpzDom<Log16>::ZpzDom(const ZpzDom<Log16>& F) :
+	_p ( F._p),
+	_pmone ( F._pmone),
+	_tab_value2rep ( F._tab_value2rep),
+	_tab_rep2value ( F._tab_rep2value),
+	_tab_mul ( F._tab_mul),
+	_tab_div ( F._tab_div),
+	_tab_neg ( F._tab_neg),
+	_tab_addone ( F._tab_addone),
+	_tab_subone ( F._tab_subone),
+	_tab_mone ( F._tab_mone),
+	_tab_pone ( F._tab_pone),
+	numRefs ( F.numRefs),
+
+	zero(F.zero), one(F.one),mOne(F.mOne)
 {
-  _p = F._p;
-  _pmone = F._pmone;
-  _tab_value2rep = F._tab_value2rep;
-  _tab_rep2value = F._tab_rep2value;
-  _tab_mul = F._tab_mul;
-  _tab_div = F._tab_div;
-  _tab_neg = F._tab_neg;
-  _tab_mone = F._tab_mone;
-  _tab_pone = F._tab_pone;
-  _tab_addone = F._tab_addone;
-  _tab_subone = F._tab_subone;
-  numRefs = F.numRefs;
   (*numRefs)++;
 #ifdef GIVARO_DEBUG
   std::cout << *(numRefs) << " Brefs, p="<<_p<<" \n";
@@ -172,6 +172,12 @@ ZpzDom<Log16>::ZpzDom(const ZpzDom<Log16>& F)
 
 ZpzDom<Log16>& ZpzDom<Log16>::operator=( const ZpzDom<Log16>& F)
 {
+
+	F.assign(const_cast<Element&>(one),F.one);
+	F.assign(const_cast<Element&>(zero),F.zero);
+	F.assign(const_cast<Element&>(mOne),F.mOne);
+
+
   if (this->numRefs) {
     (*(this->numRefs))--;
 #ifdef GIVARO_DEBUG
diff --git a/src/kernel/zpz/givzpz16table1.h b/src/kernel/zpz/givzpz16table1.h
index 1ceeda5..5ed912e 100644
--- a/src/kernel/zpz/givzpz16table1.h
+++ b/src/kernel/zpz/givzpz16table1.h
@@ -11,7 +11,7 @@
 //
 //  Modified by Pascal Giorgi on 2002/02/13  (pascal.giorgi at ens-lyon.fr)
 
-/*! @file zpz/givzpz16table1.h
+/*! @file givzpz16table1.h
  * @ingroup zpz
  * @brief  Arithmetic on Z/pZ, with tabulation of operations.
  */
@@ -49,11 +49,7 @@ public:
   typedef Residu_t* Array;
   typedef const Residu_t* constArray;
 
-  // ----- Constantes
-  const Residu_t zero;
-  const Residu_t one;
-
-  // ----- Constructor /destor
+   // ----- Constructor /destor
   ZpzDom( Residu_t p = 2 );
   ZpzDom( const ZpzDom<Log16>& F);
   ~ZpzDom();
@@ -74,7 +70,7 @@ public:
         return x = Rep((a >= _p)?0:_tab_rep2value[a]);
     }
     uint16_t& convert( uint16_t& x , const Rep a) const {
-        return x = Rep((a >= _p)?0:_tab_rep2value[a]);
+        return x = Residu_t((a >= _p)?0:_tab_rep2value[a]);
     }
     unsigned long & convert( unsigned long& x , const Rep a) const {
         return x = ((a >= _p)?0:_tab_rep2value[a]);
@@ -231,6 +227,12 @@ protected:
 
   static void Init();
   static void End();
+public:
+ // ----- Constantes
+  const Element zero;
+  const Element one;
+  const Element mOne;
+
 
 };
 
diff --git a/src/kernel/zpz/givzpz16table1.inl b/src/kernel/zpz/givzpz16table1.inl
index 8db94de..57b8b16 100644
--- a/src/kernel/zpz/givzpz16table1.inl
+++ b/src/kernel/zpz/givzpz16table1.inl
@@ -18,12 +18,20 @@
 #ifndef __GIVARO_zpz16_table1_INL
 #define __GIVARO_zpz16_table1_INL
 
-#define __GIVARO_ZPZ16_LOG_MUL(r,p,a,b) ( (r)= _tab_mul[(a) + (b)] )
-#define __GIVARO_ZPZ16_LOG_DIV(r,p,a,b) ( (r)= _tab_div[(a) - (b)] )
-#define __GIVARO_ZPZ16_LOG_INV(r,p,b)   ( (r)= _tab_div[ - (b)] )
-#define __GIVARO_ZPZ16_LOG_SUB(r,p,a,b) ( (r)= _tab_mul[(a) + _tab_subone[(b) - (a)] ] )
+#define __GIVARO_ZPZ16_LOG_MUL(r,p,a,b) ( (r)=  _tab_mul[(a) + (b)] )
+#define __GIVARO_ZPZ16_LOG_DIV(r,p,a,b) ( (r)=  _tab_div[(a) - (b)] )
+#define __GIVARO_ZPZ16_LOG_INV(r,p,b)   ( (r)=  _tab_div[ - (b)] )
+#define __GIVARO_ZPZ16_LOG_SUB(r,p,a,b) ( (r)=  _tab_mul[(a) + _tab_subone[(b) - (a)] ] )
 #define __GIVARO_ZPZ16_LOG_ADD(r,p,a,b) ( (r)=  _tab_mul[(a) + _tab_addone[(b) - (a)] ] )
-#define __GIVARO_ZPZ16_LOG_NEG(r,p,a)   ( (r)= _tab_neg[(a)] )
+#define __GIVARO_ZPZ16_LOG_NEG(r,p,a)   ( (r)=  _tab_neg[(a)] )
+
+#define __GIVARO_ZPZ16_LOG_MUL_RES(r,p,a,b) ( (r)= (Residu_t) _tab_mul[(a) + (b)] )
+#define __GIVARO_ZPZ16_LOG_DIV_RES(r,p,a,b) ( (r)= (Residu_t) _tab_div[(a) - (b)] )
+#define __GIVARO_ZPZ16_LOG_INV_RES(r,p,b)   ( (r)= (Residu_t) _tab_div[ - (b)] )
+#define __GIVARO_ZPZ16_LOG_SUB_RES(r,p,a,b) ( (r)= (Residu_t) _tab_mul[(a) + _tab_subone[(b) - (a)] ] )
+#define __GIVARO_ZPZ16_LOG_ADD_RES(r,p,a,b) ( (r)= (Residu_t) _tab_mul[(a) + _tab_addone[(b) - (a)] ] )
+#define __GIVARO_ZPZ16_LOG_NEG_RES(r,p,a)   ( (r)= (Residu_t) _tab_neg[(a)] )
+
 
 /* Pascal Giorgi
    Changing the order of parameters.
@@ -35,6 +43,11 @@
 #define __GIVARO_ZPZ16_LOG_MULSUB(r,p,a,b,c) \
 { __GIVARO_ZPZ16_LOG_MUL(r, p, a, b); __GIVARO_ZPZ16_LOG_SUB(r, p, r, c); }
 
+#define __GIVARO_ZPZ16_LOG_MULADD_RES(r,p,a,b,c) \
+{ __GIVARO_ZPZ16_LOG_MUL_RES(r, p, a, b); __GIVARO_ZPZ16_LOG_ADD_RES(r, p, r, c); }
+#define __GIVARO_ZPZ16_LOG_MULSUB_RES(r,p,a,b,c) \
+{ __GIVARO_ZPZ16_LOG_MUL_RES(r, p, a, b); __GIVARO_ZPZ16_LOG_SUB_RES(r, p, r, c); }
+
 namespace Givaro {
 
 	inline ZpzDom<Log16>::Residu_t ZpzDom<Log16>::residu( ) const
@@ -126,63 +139,63 @@ namespace Givaro {
 	inline void ZpzDom<Log16>::mul (const size_t sz, Array r, constArray a, constArray b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MUL(r[i], _p,a[i], b[i]);
+			__GIVARO_ZPZ16_LOG_MUL_RES(r[i], _p,a[i], b[i]);
 		}
 	}
 
 	inline void ZpzDom<Log16>::mul (const size_t sz, Array r, constArray a, Rep b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MUL(r[i], _p, a[i], b);
+			__GIVARO_ZPZ16_LOG_MUL_RES(r[i], _p, a[i], b);
 		}
 	}
 
 	inline void ZpzDom<Log16>::div (const size_t sz, Array r, constArray a, constArray b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_DIV( r[i], _p, a[i], b[i]);
+			__GIVARO_ZPZ16_LOG_DIV_RES( r[i], _p, a[i], b[i]);
 		}
 	}
 
 	inline void ZpzDom<Log16>::div (const size_t sz, Array r, constArray a, Rep b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_DIV( r[i], _p, a[i], b);
+			__GIVARO_ZPZ16_LOG_DIV_RES( r[i], _p, a[i], b);
 		}
 	}
 
 	inline void ZpzDom<Log16>::add (const size_t sz, Array r, constArray a, constArray b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_ADD(r[i], _p, a[i], b[i]);
+			__GIVARO_ZPZ16_LOG_ADD_RES(r[i], _p, a[i], b[i]);
 		}
 	}
 
 	inline void ZpzDom<Log16>::add (const size_t sz, Array r, constArray a, Rep b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_ADD(r[i], _p, a[i], b);
+			__GIVARO_ZPZ16_LOG_ADD_RES(r[i], _p, a[i], b);
 		}
 	}
 
 	inline void ZpzDom<Log16>::sub (const size_t sz, Array r, constArray a, constArray b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_SUB(r[i], _p, a[i], b[i]);
+			__GIVARO_ZPZ16_LOG_SUB_RES(r[i], _p, a[i], b[i]);
 		}
 	}
 
 	inline void ZpzDom<Log16>::sub (const size_t sz, Array r, constArray a, Rep b) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_SUB(r[i], _p, a[i], b);
+			__GIVARO_ZPZ16_LOG_SUB_RES(r[i], _p, a[i], b);
 		}
 	}
 
 	inline void ZpzDom<Log16>::neg (const size_t sz, Array r, constArray a) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_NEG(r[i], _p, a[i]);
+			__GIVARO_ZPZ16_LOG_NEG_RES(r[i], _p, a[i]);
 		}
 	}
 
@@ -243,7 +256,7 @@ namespace Givaro {
 	(const size_t sz, Array r, constArray a, constArray x, constArray y) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MULADD(r[i], _p, a[i], x[i], y[i]);
+			__GIVARO_ZPZ16_LOG_MULADD_RES(r[i], _p, a[i], x[i], y[i]);
 		}
 	}
 
@@ -251,7 +264,7 @@ namespace Givaro {
 	(const size_t sz, Array r, constArray a, constArray x) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MULADD(r[i], _p, a[i], x[i], r[i]);
+			__GIVARO_ZPZ16_LOG_MULADD_RES(r[i], _p, a[i], x[i], r[i]);
 		}
 	}
 
@@ -292,7 +305,7 @@ namespace Givaro {
 	(const size_t sz, Array r, constArray a, constArray x, constArray y) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MULSUB(r[i], _p, a[i], x[i], y[i]);
+			__GIVARO_ZPZ16_LOG_MULSUB_RES(r[i], _p, a[i], x[i], y[i]);
 		}
 	}
 
@@ -300,8 +313,8 @@ namespace Givaro {
 					    constArray a, constArray x) const
 	{
 		for ( size_t i=sz ; --i ; ) {
-			__GIVARO_ZPZ16_LOG_MULSUB(r[i], _p, a[i], x[i], r[i]);
-			__GIVARO_ZPZ16_LOG_NEG(r[i], _p, r[i]);
+			__GIVARO_ZPZ16_LOG_MULSUB_RES(r[i], _p, a[i], x[i], r[i]);
+			__GIVARO_ZPZ16_LOG_NEG_RES(r[i], _p, r[i]);
 		}
 	}
 
@@ -378,10 +391,10 @@ namespace Givaro {
 		int sign; unsigned long ua;
 		if (a <0) {
 			sign =-1;
-			ua = -a;
+			ua = (unsigned long)-a;
 		}
 		else {
-			ua = a;
+			ua = (unsigned long)a;
 			sign =1;
 		}
 		r = Rep( (ua >_p) ? ua % _p : ua );
@@ -438,7 +451,7 @@ namespace Givaro {
 			if (tr)
 				return r = _tab_value2rep[ _p - (uint16_t)tr ];
 			else
-				return r = zero;
+				return r = (Rep) zero;
 		} else {
 			if (Residu >= (Integer)_p ) tr =   int16_t(Residu % _p) ;
 			else tr = int16_t(Residu);
@@ -454,7 +467,7 @@ namespace Givaro {
 		unsigned int stride = 1;
 		if ((unsigned long)bound < GIVARO_MAXUINT16)
 			stride = (unsigned int) ( GIVARO_MAXUINT32/((unsigned long)bound * (unsigned long)bound) );
-		uint32_t dot = zero;
+		uint32_t dot = (uint32_t)zero;
 		if ((sz <10) && (sz <stride)) {
 			for(  size_t i= sz; i--; )
 				dot += _tab_rep2value[a[i]] * _tab_rep2value[b[i]];
@@ -463,7 +476,7 @@ namespace Givaro {
 
 		}
 		unsigned int i_begin=0;
-		stride &= ~0x1;
+		stride &= (unsigned int)~0x1;
 		if (stride ==0) {
 			for(  size_t i= sz-1; i>0; --i) {
 				dot += _tab_rep2value[a[i]] * _tab_rep2value[b[i]];
@@ -521,7 +534,7 @@ label1:
 			d_2_l tmp;
 			// - normalization: put fractional part at the end of the representation
 			tmp.d = a[i] + offset;
-			r[i--] = _tab_value2rep[(tmp.r[1] >_p ? tmp.r[1] : tmp.r[1] % _p)];
+			r[i--] = (Residu_t)_tab_value2rep[(tmp.r[1] >_p ? tmp.r[1] : tmp.r[1] % _p)];
 		}
 		// while (i!=0)
 		if (i >0) goto label1;
@@ -570,11 +583,11 @@ label1:
 
 	inline std::istream& ZpzDom<Log16>::read (std::istream& s, Rep& a) const
 	{
-		int tmp; //dpritcha
+		Integer tmp; 
 		s >> tmp;
 		tmp %= _p;
 		if (tmp < 0) tmp += _p;
-		a = _tab_value2rep[tmp];
+		a = _tab_value2rep[ (uint)tmp ];
 		return s;
 	}
 
diff --git a/src/kernel/zpz/givzpz32std.h b/src/kernel/zpz/givzpz32std.h
index c079b21..2925500 100644
--- a/src/kernel/zpz/givzpz32std.h
+++ b/src/kernel/zpz/givzpz32std.h
@@ -11,9 +11,9 @@
 //
 //  Modified by Pascal Giorgi on 2002/02/13  (pascal.giorgi at ens-lyon.fr)
 
-/*! @file zpz/givzps32std.h
+/*! @file givzpz32std.h
  * @ingroup zpz
- * @brief Arithmetic on Z/pZ, with p a prime number less than 2^32.
+ * @brief Arithmetic on \c Z/pZ, with p a prime number less than \f$2^32\f$.
  *   Modulo typedef is a signed long number. In case it was modified
  *   then Bézout algorithm must be changed (coefficient can be negative).
  */
@@ -30,12 +30,12 @@
 
 
 namespace Givaro {
+
 /*! @brief This class implement the standard arithmetic with Modulo Elements.
  * - The representation of an integer a in Zpz is the value a % p
  * - p max is 46337
  * .
  */
-
 template<>
 class ZpzDom<Std32> {
 public:
@@ -53,16 +53,17 @@ public:
   // ----- Constantes
   const Rep zero;
   const Rep one;
+  const Rep mOne;
 
   // ----- Constructor
-  ZpzDom()
-	  : zero(0), one(1), _p(0), _dp(0.0) {}
+  ZpzDom() :
+	  zero(0), one(1), mOne(-1), _p(0), _dp(0.0) {}
 
-  ZpzDom( Residu_t p )
-	  : zero(0), one(1), _p(p), _dp((double)p) {}
+  ZpzDom( Residu_t p ) :
+	  zero(0), one(1), mOne((Rep)p-1), _p(p), _dp((double)p) {}
 
   ZpzDom( const ZpzDom<Std32>& F)
-	  : zero(0), one(1), _p(F._p), _dp(F._dp) {}
+	  : zero(F.zero), one(F.one), mOne(F.mOne), _p(F._p), _dp(F._dp) {}
 
 
 
@@ -70,10 +71,15 @@ public:
   int operator==( const ZpzDom<Std32>& BC) const { return _p == BC._p;}
   int operator!=( const ZpzDom<Std32>& BC) const { return _p != BC._p;}
 
-  ZpzDom<Std32>& operator=( const ZpzDom<Std32>& F) {
-      this->_p = F._p;
-      this->_dp = F._dp;
-      return *this;
+  ZpzDom<Std32>& operator=( const ZpzDom<Std32>& F)
+  {
+	  F.assign(const_cast<Element&>(one),F.one);
+	  F.assign(const_cast<Element&>(zero),F.zero);
+	  F.assign(const_cast<Element&>(mOne),F.mOne);
+
+	  this->_p = F._p;
+	  this->_dp = F._dp;
+	  return *this;
   }
 
   // ----- Access to the modulus
diff --git a/src/kernel/zpz/givzpz32std.inl b/src/kernel/zpz/givzpz32std.inl
index fc821f6..0e30228 100644
--- a/src/kernel/zpz/givzpz32std.inl
+++ b/src/kernel/zpz/givzpz32std.inl
@@ -19,13 +19,13 @@
 // -- normalized operations
 // ---------
 // r = a*b
-#define __GIVARO_ZPZ32_N_MUL(r,p,a,b) ( r = (uint32_t)(a*b) % (uint32_t)p )
+#define __GIVARO_ZPZ32_N_MUL(r,p,a,b) ( r = (Rep) ( (uint32_t)(a*b) % (uint32_t)p ) )
 // r *= a
-#define __GIVARO_ZPZ32_N_MULIN(r,p,a) (  r = (uint32_t)(r*a) % (uint32_t)p  )
+#define __GIVARO_ZPZ32_N_MULIN(r,p,a) (  r = (Rep) ( (uint32_t)(r*a) % (uint32_t)p  ) )
 
 // r = a - b
 //#define __GIVARO_ZPZ32_N_SUB(r,p,a,b) ( r = (a>b)? a-b: (p-b)+a )
-#define __GIVARO_ZPZ32_N_SUB(r,p,a,b) ( r = ( (r=a-b) < 0 ? r+p : r ) )
+#define __GIVARO_ZPZ32_N_SUB(r,p,a,b) ( r = (Rep) ( (r=a-b) < 0 ? r+p : r ) )
 // r -= a
 #define __GIVARO_ZPZ32_N_SUBIN(r,p,a) { r -= a; r= (r < 0 ? r+p : r); }
 
@@ -35,15 +35,15 @@
 #define __GIVARO_ZPZ32_N_ADDIN(r,p,a) { r += a;  r= (r < p ? r : r-p); }
 
 // r <- a*b+c % p
-#define __GIVARO_ZPZ32_N_MULADD(r,p,a,b,c) ( r = (uint32_t)(a*b+c) % (uint32_t)p )
+#define __GIVARO_ZPZ32_N_MULADD(r,p,a,b,c) ( r = (Rep) ( (uint32_t)(a*b+c) % (uint32_t)p ) )
 
-#define __GIVARO_ZPZ32_N_MULADDIN(r,p,a,b) ( r = (uint32_t)(a*b+r) % (uint32_t)p )
+#define __GIVARO_ZPZ32_N_MULADDIN(r,p,a,b) ( r = (Rep) ( (uint32_t)(a*b+r) % (uint32_t)p ) )
 
 #define __GIVARO_ZPZ32_N_NEG(r,p,a) ( r = (a == 0 ? 0 : p-a) )
 #define __GIVARO_ZPZ32_N_NEGIN(r,p) ( r = (r == 0 ? 0 : p-r) )
 
 // a*b-c
-#define __GIVARO_ZPZ32_N_MULSUB(r,p,a,b,c) ( r = (uint32_t)(a*b+p-c) % (uint32_t)p )
+#define __GIVARO_ZPZ32_N_MULSUB(r,p,a,b,c) ( r = (Rep) ( (uint32_t)(a*b+p-c) % (uint32_t)p ) )
 
 // r-a*b
 #define __GIVARO_ZPZ32_N_SUBMULIN(r,p,a,b) { \
@@ -58,12 +58,12 @@ namespace Givaro {
 
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::mul (Rep& r, const Rep a, const Rep b) const
 	{
-		return __GIVARO_ZPZ32_N_MUL(r,(int32_t)_p,(int32_t)a,(int32_t)b);
+		return  __GIVARO_ZPZ32_N_MUL(r,(int32_t)_p,(int32_t)a,(int32_t)b);
 	}
 
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::sub (Rep& r, const Rep a, const Rep b) const
 	{
-		return __GIVARO_ZPZ32_N_SUB(r,_p,a,b);
+		return __GIVARO_ZPZ32_N_SUB(r,(int32_t)_p,(int32_t)a,(int32_t)b);
 	}
 
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::add (Rep& r, const Rep a, const Rep b) const
@@ -80,9 +80,9 @@ namespace Givaro {
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::inv (Rep& r, const Rep a) const
 	{
 		int32_t u;
-		ZpzDom<Std32>::invext(u, a, _p);
+		ZpzDom<Std32>::invext(u, a, (int32_t)_p);
 		//   if ((d != 1) && (d != -1)) std::cerr << "GivMathDivZero(Zpz::inv)" << std::endl;
-		return r = (u<0)?(ZpzDom<Std32>::Rep)u + _p:(ZpzDom<Std32>::Rep)u;
+		return r = (u<0)?(ZpzDom<Std32>::Rep)u + (int32_t)_p:(ZpzDom<Std32>::Rep)u;
 	}
 
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::div (Rep& r, const Rep a, const Rep b) const
@@ -204,9 +204,9 @@ namespace Givaro {
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::invin (Rep& r) const
 	{
 		int32_t u;
-		ZpzDom<Std32>::invext(u, r, _p);
+		ZpzDom<Std32>::invext(u, r, (int32_t)_p);
 		//   if ((d != 1) && (d != -1)) std::cerr << "GivMathDivZero(Zpz::invin)" << std::endl;
-		return r = (u<0)?(ZpzDom<Std32>::Rep)u + _p:(ZpzDom<Std32>::Rep)u;
+		return r = (u<0)?(ZpzDom<Std32>::Rep)u + (int32_t)_p:(ZpzDom<Std32>::Rep)u;
 	}
 
 	inline ZpzDom<Std32>::Rep& ZpzDom<Std32>::axpy (Rep& r,
@@ -333,8 +333,8 @@ namespace Givaro {
 			ua = fmod(ua,_dp);
 			r = (Rep) ua;
 		} else
-			r = (ua >=_p) ? (uint32_t) ua % (uint32_t)_p : (uint32_t) ua;
-		if (r && (sign ==-1)) r = _p - r;
+			r = (Rep)((ua >=_p) ? (uint32_t) ua % (uint32_t)_p : (uint32_t) ua);
+		if (r && (sign ==-1)) r = (int32_t)_p - r;
 		return r;
 	}
 
@@ -346,16 +346,25 @@ namespace Givaro {
 
 
 	inline  ZpzDom<Std32>::Rep&  ZpzDom<Std32>::init ( Rep& r, const unsigned long a ) const
-	{ return r = (Rep)( a >= (unsigned long)_p ? a % (unsigned long)_p : a);
+	{
+	       	return r = (Rep)( a >= (unsigned long)_p ? a % (unsigned long)_p : a);
 	}
 
 	inline  ZpzDom<Std32>::Rep&  ZpzDom<Std32>::init ( Rep& r, const long a ) const
 	{
-		int sign; unsigned long ua;
-		if (a <0) { sign =-1; ua = -a;}
-		else { ua = a; sign =1; }
+		int sign;
+		unsigned long ua;
+		if (a <0) {
+			sign =-1;
+			ua = (unsigned long)-a;
+		}
+		else {
+			ua = (unsigned long) a;
+		       	sign =1;
+		}
 		r = Rep((ua >=_p) ? ua % (uint32_t)_p : ua);
-		if (r && (sign ==-1)) r = _p - r;
+		if (r && (sign ==-1))
+			r = (int32_t)_p - r;
 		return r;
 	}
 
@@ -365,13 +374,16 @@ namespace Givaro {
 		if (Residu <0) {
 			// -a = b [p]
 			// a = p-b [p]
-			if ( Residu <= (Integer)(-_p) ) tr = long( (-Residu) % _p) ;
-			else tr = long(-Residu);
+			if ( Residu <= (Integer)(-_p) )
+			       	tr = long( (-Residu) % _p) ;
+			else
+				tr = long(-Residu);
 			if (tr)
 				return r = Rep(_p - (unsigned long)tr);
 			else
 				return r = zero;
-		} else {
+		}
+		else {
 			if (Residu >= (Integer)_p ) tr =   long(Residu % _p) ;
 			else tr = long(Residu);
 			return r = Rep(tr);
@@ -425,31 +437,33 @@ namespace Givaro {
 			//    stride = GIVARO_MAXULONG/((unsigned long)bound * (unsigned long)bound);
 			//    hopefully stride is not unsigned long !?!
 			stride = (unsigned int) (GIVARO_MAXULONG/((unsigned long)bound) / ((unsigned long)bound));
-		unsigned long dot = zero;
+		unsigned long dot = (unsigned long)zero;
 		if ((sz <10) && (sz <stride)) {
 			for(  size_t i= sz; i--; )
-				dot += a[i] * b[i];
-			if (dot > _p)  return r = (Rep)(dot % (int32_t)_p);
+				dot += (unsigned long)a[i] * (unsigned long)b[i];
+			if (dot > _p)  return r = (Rep)(dot % (unsigned long)_p);
 			else  return r = (Rep)dot;
 		}
 		size_t i_begin=0;
-		stride &= ~0x1;
+		stride &= (unsigned int)~0x1;
 		if (stride ==0) {
 			for(  size_t i= sz; --i; ) {
-				dot += a[i] * b[i];
+				dot += (unsigned long) a[i] * (unsigned long)b[i];
 				if (dot>_p) dot %= _p;
 			}
 			return r = (Rep)dot;
 		}
 		do {
 			size_t min_sz = ((sz-i_begin) < stride ? (sz-i_begin) : stride);
-			if ((min_sz & 0x1) !=0)
-			{ min_sz--; i_begin++; dot += a++[min_sz] * b++[min_sz]; }
+			if ((min_sz & 0x1) !=0) {
+				min_sz--; i_begin++;
+				dot += (unsigned int) a++[min_sz] * (unsigned int)b++[min_sz];
+			}
 			if (min_sz > 1)
 				for(  size_t i= min_sz; i>0; --i, --i, ++a, ++a, ++b, ++b )
 				{
-					dot += a[0] * b[0];
-					dot += a[1] * b[1];
+					dot += (unsigned int)a[0] * (unsigned int)b[0];
+					dot += (unsigned int)a[1] * (unsigned int)b[1];
 				}
 			if (dot>_p) dot %= _p;
 			i_begin += min_sz;
@@ -499,7 +513,7 @@ namespace Givaro {
 	inline ZpzDom<Std32>::Rep&  ZpzDom<Std32>::dotprod
 	( Rep& r, const size_t sz, constArray a, constArray b ) const
 	{
-		return ZpzDom<Std32>::dotprod(r, _p, sz, a, b);
+		return ZpzDom<Std32>::dotprod(r, (int32_t)_p, sz, a, b);
 	}
 
 
@@ -571,8 +585,9 @@ namespace Givaro {
 
 	inline std::istream& ZpzDom<Std32>::read (std::istream& s, Rep& a) const
 	{
-		s >> a;
-		init(a, a);
+		Integer tmp;
+		s >> tmp;
+		init(a, tmp);
 		return s;
 	}
 
diff --git a/src/kernel/zpz/givzpz32uns.C b/src/kernel/zpz/givzpz32uns.C
index cc2eb5a..72e6a9a 100644
--- a/src/kernel/zpz/givzpz32uns.C
+++ b/src/kernel/zpz/givzpz32uns.C
@@ -40,21 +40,33 @@ namespace Givaro {
 	}
 
 	uint32_t& ZpzDom<Unsigned32>::invext
-	( uint32_t& u, const uint32_t a, const uint32_t b ) const
+	( uint32_t& u1, const uint32_t a, const uint32_t b ) const
 	{
-		long u1,u3;
-		long v1,v3;
-		u1 = 1; u3 = a;
-		v1 = 0; v3 = b;
-		while (v3 != 0)
-		{
-			long q, t1, t3;
-			q = u3 / v3;
-			t1 = u1 - q * v1; t3 = u3 - q * v3;
-			u1 = v1; u3 = v3; v1 = t1; v3 = t3;
-		}
-		v1=(u3<0?-u1:u1);
-		return u=uint32_t(v1<0?b+v1:v1);
+            u1=one;
+            uint32_t r0(_p), r1(a);
+            uint32_t q(r0/r1);
+            
+            r0 -= q * r1;
+            if (r0 == zero) return u1;
+            uint32_t u0 = q;
+            
+            q = r1/r0;
+            r1 -= q * r0; 
+            
+            while (r1 != zero) {
+                u1 += q * u0;
+                
+                q = r0/r1;
+                r0 -= q * r1;
+                if (r0 == zero) return u1;
+                u0 += q * u1;
+                
+                q = r1/r0;
+                r1 -= q * r0; 
+                
+            }
+            
+            return u1=_p-u0;
 	}
 
 
diff --git a/src/kernel/zpz/givzpz32uns.h b/src/kernel/zpz/givzpz32uns.h
index 41cba3f..2e783e1 100644
--- a/src/kernel/zpz/givzpz32uns.h
+++ b/src/kernel/zpz/givzpz32uns.h
@@ -11,7 +11,7 @@
 //
 //  Modified by Pascal Giorgi on 2002/02/13  (pascal.giorgi at ens-lyon.fr)
 
-/*! @file zpz/givzpz32uns.h
+/*! @file givzpz32uns.h
  * @ingroup zpz
  * @brief    Arithmetic on Z/pZ, with p a prime number less than 2^32.
  *   Modulo typedef is a signed long number. In case it was modified
@@ -33,7 +33,6 @@ namespace Givaro {
  * - The representation of an integer a in Zpz is the value a % p
  * .
  */
-
 template<>
 class ZpzDom<Unsigned32> {
 public:
@@ -51,6 +50,7 @@ public:
   // ----- Constantes
   const Rep zero;
   const Rep one;
+  const Rep mOne;
 
   // ----- Constructor
   ZpzDom();
@@ -60,10 +60,16 @@ public:
   int operator==( const ZpzDom<Unsigned32>& BC) const { return _p == BC._p;}
   int operator!=( const ZpzDom<Unsigned32>& BC) const { return _p != BC._p;}
 
-  ZpzDom<Unsigned32>& operator=( const ZpzDom<Unsigned32>& F) {
-      this->_p = F._p;
-      this->_dp = F._dp;
-      return *this;
+  ZpzDom<Unsigned32>& operator=( const ZpzDom<Unsigned32>& F)
+  {
+	  F.assign(const_cast<Element&>(one),F.one);
+	  F.assign(const_cast<Element&>(zero),F.zero);
+	  F.assign(const_cast<Element&>(mOne),F.mOne);
+
+
+	  this->_p = F._p;
+	  this->_dp = F._dp;
+	  return *this;
   }
 
   // ----- Access to the modulus
diff --git a/src/kernel/zpz/givzpz32uns.inl b/src/kernel/zpz/givzpz32uns.inl
index 22be6c0..b840e28 100644
--- a/src/kernel/zpz/givzpz32uns.inl
+++ b/src/kernel/zpz/givzpz32uns.inl
@@ -54,12 +54,12 @@
 
 namespace Givaro {
 
-	inline ZpzDom<Unsigned32>::ZpzDom( )
-	: zero(0), one(1), _p(0), _dp(0.0)
+	inline ZpzDom<Unsigned32>::ZpzDom( ) :
+		zero(0), one(1), mOne(0), _p(0), _dp(0.0)
 	{}
 
-	inline ZpzDom<Unsigned32>::ZpzDom( Residu_t p )
-	: zero(0), one(1), _p(p), _dp((double)p)
+	inline ZpzDom<Unsigned32>::ZpzDom( Residu_t p ) :
+		zero(0), one(1), mOne(Rep(p-1)),_p(p), _dp((double)p)
 
 	{}
 
@@ -68,8 +68,8 @@ namespace Givaro {
 		return _p;
 	}
 
-	inline ZpzDom<Unsigned32>::ZpzDom(const ZpzDom<Unsigned32>& F)
-	: zero(0), one(1), _p(F._p), _dp(F._dp)
+	inline ZpzDom<Unsigned32>::ZpzDom(const ZpzDom<Unsigned32>& F) :
+		zero(F.zero), one(F.one), mOne(F.mOne), _p(F._p), _dp(F._dp)
 	{ }
 
 	inline ZpzDom<Unsigned32>::Rep& ZpzDom<Unsigned32>::mul (Rep& r, const Rep a, const Rep b) const
@@ -377,10 +377,10 @@ namespace Givaro {
 		unsigned long ua;
 		if (a <0) {
 			sign =-1;
-			ua = -a;
+			ua = (unsigned long)-a;
 		}
 		else {
-			ua = a;
+			ua = (unsigned long)a;
 			sign =1;
 		}
 		r = Rep( (ua >=_p) ? ua % _p : ua );
@@ -513,7 +513,7 @@ namespace Givaro {
 				return r = (Rep)dot;
 		}
 		size_t i_begin=0;
-		stride &= ~0x1;
+		stride &= (unsigned int)~0x1;
 		if (stride ==0) {
 			for(  size_t i= sz; --i; ) {
 				dot += a[i] * b[i];
@@ -583,7 +583,7 @@ namespace Givaro {
 	inline ZpzDom<Unsigned32>::Rep&  ZpzDom<Unsigned32>::dotprod
 	( Rep& r, const size_t sz, constArray a, constArray b ) const
 	{
-		return ZpzDom<Unsigned32>::dotprod(r, _p, sz, a, b);
+		return ZpzDom<Unsigned32>::dotprod(r, (int)_p, sz, a, b);
 	}
 
 
@@ -655,8 +655,9 @@ namespace Givaro {
 
 	inline std::istream& ZpzDom<Unsigned32>::read (std::istream& s, Rep& a) const
 	{
-		s >> a;
-		init(a, a);
+		Integer tmp;
+		s >> tmp;
+		init(a, tmp);
 		return s;
 	}
 
diff --git a/src/kernel/zpz/givzpz64std.h b/src/kernel/zpz/givzpz64std.h
index 53fa401..fb2107c 100644
--- a/src/kernel/zpz/givzpz64std.h
+++ b/src/kernel/zpz/givzpz64std.h
@@ -9,9 +9,9 @@
 // $Id: givzpz64std.h,v 1.21 2011-02-04 14:11:46 jgdumas Exp $
 // ==========================================================================
 
-/*! @file zpz/givzpz64std.h
+/*! @file givzpz64std.h
  * @ingroup zpz
- * @brief Description.
+ * @brief Zpz on 64bit words
  *   Arithmetic on Z/pZ, with p a prime number less than 2^64
  *   Modulo typedef is a signed long number. In case it was modified
  *   then Bézout algorithm must be changed (coefficient can be negative).
@@ -32,7 +32,6 @@ namespace Givaro {
  * - p max is 2147483647
  * .
  */
-
 template<>
 class ZpzDom<Std64>
 {
@@ -54,13 +53,22 @@ public:
 	// ----- Constantes
 	const Rep zero;
 	const Rep one;
+	const Rep mOne;
 
 	// ----- Constructor
-	ZpzDom() : zero(0), one(1), _p(0) {}
-	ZpzDom( Residu_t p, unsigned long = 1) : zero(0), one(1), _p(p) {}
+	ZpzDom() :
+		zero(0), one(1), mOne(-1), _p(0) {}
+	ZpzDom( Residu_t p, unsigned long = 1) :
+	       	zero(0), one(1), mOne((Rep)p-1), _p(p) {}
+
+
+	Self_t& operator= (const Self_t& D)
+	{
+	  assign(const_cast<Element&>(one),D.one);
+	  assign(const_cast<Element&>(zero),D.zero);
+	  assign(const_cast<Element&>(mOne),D.mOne);
 
 
-	Self_t& operator= (const Self_t& D) {
 		this->_p = D._p;
 		return *this;
 	}
diff --git a/src/kernel/zpz/givzpz64std.inl b/src/kernel/zpz/givzpz64std.inl
index 044b8a6..ea740d2 100644
--- a/src/kernel/zpz/givzpz64std.inl
+++ b/src/kernel/zpz/givzpz64std.inl
@@ -22,9 +22,9 @@
 #ifndef __DONOTUSE_Givaro_SIXTYFOUR__
 
 // r = a*b
-#define __GIVARO_ZPZ64_N_MUL(r,p,a,b) ( r = (uint64_t)(a*b) % (uint64_t)p )
+#define __GIVARO_ZPZ64_N_MUL(r,p,a,b) ( r = (Rep) ( (uint64_t)(a*b) % (uint64_t)p ) )
 // r *= a
-#define __GIVARO_ZPZ64_N_MULIN(r,p,a) (  r = (uint64_t)(r*a) % (uint64_t)p  )
+#define __GIVARO_ZPZ64_N_MULIN(r,p,a) (  r = (Rep) ( (uint64_t)(r*a) % (uint64_t)p  ) )
 
 // r = a - b
 #define __GIVARO_ZPZ64_N_SUB(r,p,a,b) { r = (a-b); r= (r < 0 ? r+p : r);}
@@ -37,15 +37,15 @@
 #define __GIVARO_ZPZ64_N_ADDIN(r,p,a) { r += a;  r= (r < p ? r : r-p);}
 
 // r <- a*b+c % p
-#define __GIVARO_ZPZ64_N_MULADD(r,p,a,b,c) ( r = (uint64_t)(a*b+c) % (uint64_t)p )
+#define __GIVARO_ZPZ64_N_MULADD(r,p,a,b,c) ( r = (Rep) ( (uint64_t)(a*b+c) % (uint64_t)p ) )
 
-#define __GIVARO_ZPZ64_N_MULADDIN(r,p,a,b) ( r = (uint64_t)(a*b+r) % (uint64_t)p )
+#define __GIVARO_ZPZ64_N_MULADDIN(r,p,a,b) ( r = (Rep) ( (uint64_t)(a*b+r) % (uint64_t)p ) )
 
 #define __GIVARO_ZPZ64_N_NEG(r,p,a) { r = (a == 0 ? 0 : p-a); }
 #define __GIVARO_ZPZ64_N_NEGIN(r,p) { r = (r == 0 ? 0 : p-r); }
 
 // a*b-c
-#define __GIVARO_ZPZ64_N_MULSUB(r,p,a,b,c) ( r = (uint64_t)(a*b+p-c) % (uint64_t)p )
+#define __GIVARO_ZPZ64_N_MULSUB(r,p,a,b,c) ( r = (Rep) ( (uint64_t)(a*b+p-c) % (uint64_t)p ) )
 
 // r-a*b
 #define __GIVARO_ZPZ64_N_SUBMULIN(r,p,a,b) { \
@@ -74,8 +74,8 @@ inline ZpzDom<Std64>::Rep& ZpzDom<Std64>::inv (Rep& r, const Rep a) const
 {
 //    int64_t d, u, v;
    int64_t u;
-  ZpzDom<Std64>::invext(u, a, _p);
-  return r = (u<0)?(ZpzDom<Std64>::Rep)(u+_p):(ZpzDom<Std64>::Rep)u;
+  ZpzDom<Std64>::invext(u, a, (int64_t)_p);
+  return r = (u<0)?(ZpzDom<Std64>::Rep)(u+(int64_t)_p):(ZpzDom<Std64>::Rep)u;
  }
 
 inline ZpzDom<Std64>::Rep& ZpzDom<Std64>::div (Rep& r, const Rep a, const Rep b) const
@@ -218,8 +218,8 @@ inline ZpzDom<Std64>::Rep& ZpzDom<Std64>::negin (Rep& r) const
 inline ZpzDom<Std64>::Rep& ZpzDom<Std64>::invin (Rep& r) const
 {
    int64_t u;
-  ZpzDom<Std64>::invext(u, r, _p);
-  return r = (u<0)?(ZpzDom<Std64>::Rep)(u+_p):(ZpzDom<Std64>::Rep)u;
+  ZpzDom<Std64>::invext(u, r, (int64_t)_p);
+  return r = (u<0)?(ZpzDom<Std64>::Rep)(u+(int64_t)_p):(ZpzDom<Std64>::Rep)u;
 }
 
 
@@ -366,30 +366,30 @@ inline  ZpzDom<Std64>::Rep&  ZpzDom<Std64>::init ( Rep& r, const unsigned long a
 inline  ZpzDom<Std64>::Rep&  ZpzDom<Std64>::init ( Rep& r, const long a ) const
 {
   int64_t sign; uint64_t ua;
-  if (a <0) { sign =-1; ua = -a;}
-  else { ua = a; sign =1; }
-  r = (ua >=_p) ? ua % (uint64_t)_p : ua;
-  if (r && (sign ==-1)) r = _p - r;
+  if (a <0) { sign =-1; ua = (unsigned int)-a;}
+  else { ua = (unsigned int)a; sign =1; }
+  r = (Rep)((ua >=_p) ? ua % (uint64_t)_p : ua);
+  if (r && (sign ==-1)) r = (Rep)_p - r;
   return r;
 }
 
 
 inline ZpzDom<Std64>::Rep&  ZpzDom<Std64>::init ( Rep& r, const Integer& Residu ) const
 {
-  int64_t tr;
   if (Residu <0) {
-      // -a = b [p]
-      // a = p-b [p]
-    if ( (-Residu) >= (Integer)(_p) ) tr = int64_t( (-Residu) % (Integer)_p) ;
-    else tr = int64_t(-Residu);
-    if (tr)
-      return r = (uint64_t)_p - (uint64_t)tr;
-    else
-      return r = zero;
+      int64_t tr;
+          // -a = b [p]
+          // a = p-b [p]
+      if ( (-Residu) >= (Integer)(_p) ) tr = int64_t( (-Residu) % (Integer)_p) ;
+      else tr = int64_t(-Residu);
+      if (tr)
+          return r = (Rep)( (uint64_t)_p - (uint64_t)tr ) ;
+      else
+          return r = zero;
   } else {
-      if (Residu >= (Integer)_p ) tr =   int64_t(Residu % (Integer)_p) ;
-    else tr = int64_t(Residu);
-    return r = tr;
+      Integer ip(_p);
+      if (Residu >= ip ) return r =   int64_t(Residu % ip) ;
+      else return r = int64_t(Residu);
   }
 }
 
@@ -417,10 +417,10 @@ inline  ZpzDom<Std64>::Rep&  ZpzDom<Std64>::init ( Rep& r, const float a ) const
 inline  ZpzDom<Std64>::Rep&  ZpzDom<Std64>::init ( Rep& r, const long long a ) const
 {
   int sign; uint64_t ua;
-  if (a <0) { sign =-1; ua = -a;}
-  else { ua = a; sign =1; }
-  r = (ua >=_p) ? ua % (uint64_t)_p : ua;
-  if (r && (sign ==-1)) r = _p - r;
+  if (a <0) { sign =-1; ua = (unsigned int)-a;}
+  else { ua = (unsigned int)a; sign =1; }
+  r = (Rep) ( (ua >=_p) ? ua % (uint64_t)_p : ua) ;
+  if (r && (sign ==-1)) r = (Rep)_p - r;
   return r;
 }
 
@@ -493,20 +493,29 @@ inline void ZpzDom<Std64>::dotprod
   unsigned int stride = 1;
   if ((int64_t)bound < Signed_Trait<Rep>::max() )
    stride = (unsigned int) ( GIVARO_MAXULONG/((unsigned long)bound * (unsigned long)bound) );
-  unsigned long dot = zero;
+  unsigned long dot = (unsigned long) zero; // this is intented !
   if ((sz <10) && (sz <stride)) {
     for(  size_t i= sz; i--; )
-      dot += a[i] * b[i];
+#ifdef __x86_64__
+      dot += (unsigned long)a[i] * (unsigned long)b[i];
+#else
+      dot = (unsigned long) (dot + a[i] * b[i]);
+#endif
     if (dot > _p) r = (Rep)(dot % (uint64_t)_p);
     else r = (Rep)dot;
     return;
   }
   unsigned int i_begin=0;
-  stride &= ~0x1;
+  stride &= (unsigned int)~0x1;
   if (stride ==0) {
     for(  size_t i= sz; --i; ) {
-      dot += a[i] * b[i];
+#ifdef __x86_64__
+      dot += (unsigned long)a[i] * (unsigned long)b[i];
       if (dot>_p) dot %= _p;
+#else
+      dot = (unsigned long) (dot + a[i] * b[i]);
+      if (dot>_p) dot = (unsigned long) (dot % _p);
+#endif
     }
     r = (Rep)dot;
     return;
@@ -514,14 +523,32 @@ inline void ZpzDom<Std64>::dotprod
   do {
     size_t min_sz = ((sz-i_begin) < stride ? (sz-i_begin) : stride);
     if ((min_sz & 0x1) !=0)
-      { min_sz--; i_begin++; dot += a++[min_sz] * b++[min_sz]; }
+      {
+	      --min_sz;
+	      ++i_begin;
+#ifdef __x86_64__
+	      dot += (unsigned long)a++[min_sz] * (unsigned long)b++[min_sz];
+#else
+	      dot = (unsigned long) (dot + a++[min_sz] * b++[min_sz]);
+#endif
+      }
     if (min_sz > 1)
       for(  size_t i= min_sz; i>0; --i, --i, ++a, ++a, ++b, ++b ) //!@todo o_O
       {
-        dot += a[0] * b[0];
-        dot += a[1] * b[1];
+#ifdef __x86_64__
+        dot += (unsigned long)a[0] * (unsigned long)b[0];
+        dot += (unsigned long)a[1] * (unsigned long)b[1];
+#else
+	dot = (unsigned long) (dot +  a[0] * b[0] );
+	dot = (unsigned long) (dot +  a[1] * b[1] );
+#endif
+
       }
+#ifdef __x86_64__
     if (dot>(uint64_t)_p) dot %= (uint64_t)_p;
+#else
+    if (dot>_p) dot = (unsigned long) (dot % _p);
+#endif
     i_begin += (unsigned int) min_sz;
   } while (i_begin <sz);
   r = (Rep)dot;
@@ -604,8 +631,9 @@ inline std::ostream& ZpzDom<Std64>::write (std::ostream& s ) const
 
 inline std::istream& ZpzDom<Std64>::read (std::istream& s, Rep& a) const
 {
-  s >> a;
-  init(a, a);
+  Integer tmp;
+  s >> tmp;
+  init(a, tmp);
   return s;
 }
 
diff --git a/src/kernel/zpz/givzpzInt.h b/src/kernel/zpz/givzpzGen.h
similarity index 75%
copy from src/kernel/zpz/givzpzInt.h
copy to src/kernel/zpz/givzpzGen.h
index d41ce81..6390a64 100644
--- a/src/kernel/zpz/givzpzInt.h
+++ b/src/kernel/zpz/givzpzGen.h
@@ -1,6 +1,6 @@
 // ==========================================================================
-// $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givzpzInt.h,v $
-// Copyright(c)'1994-2009 by The Givaro group
+// $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givzpzGen.h,v $
+// Copyright(c)'1994-2012 by The Givaro group
 // This file is part of Givaro.
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
@@ -9,18 +9,17 @@
 // $Id: givzpzInt.h,v 1.11 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*! @file zpz/givzpzInt.h
+/*! @file givzpzInt.h
  * @ingroup zpz
  *  @brief Arithmetic on Z/pZ, with p a prime number in arbitrary precision.
  */
 
-#ifndef __GIVARO_zpz_int_H
-#define __GIVARO_zpz_int_H
+#ifndef __GIVARO_zpz_gen_H
+#define __GIVARO_zpz_gen_H
 
 #include "givaro/givbasictype.h"
 #include "givaro/giverror.h"
 #include "givaro/givzpztypes.h"
-#include "givaro/givinteger.h"
 #include "givaro/giv_randiter.h"
 
 
@@ -30,80 +29,108 @@ namespace Givaro {
  * - The representation of an integer a in Zpz is the value a % p
  * .
  */
-
-template<>
-class ZpzDom<Integer> {
+template<typename IntType>
+class ZpzDom {
 public:
   // ----- Exported Types and constantes
-  typedef Integer Residu_t;                    // - type to store residue
-  enum { size_rep = sizeof(Residu_t) };      // - size of the storage type
-  // ----- Representation of Element of the domain ZpzDom
-  typedef Integer Rep;
-  typedef Integer Element;
-
-  // ----- Representation of vector of the Element
+  typedef IntType Residu_t;                    //!<  type to store residue
+  enum { size_rep = sizeof(Residu_t) };      //!<  size of the storage type
+  //! Representation of Element of the domain ZpzDom
+  typedef IntType Rep;
+  typedef IntType Element;
+
+  //! Representation of vector of the Element
+  //@{
   typedef Rep* Array;
   typedef const Rep* constArray;
-
-  // ----- Constantes
-  const Rep zero;
-  const Rep one;
-
-  // ----- Constructor
-  ZpzDom() : zero(0), one(1), _p(0) {}
-  ZpzDom( Residu_t p ) : zero(0), one(1), _p(p) {}
-  ZpzDom( const ZpzDom<Integer>& F) : zero(0), one(1), _p(F._p) { }
+  //@}
+
+  //! Constantes
+  //@{
+  const Rep zero; //!< 0
+  const Rep one;  //!< 1
+  const Rep mOne; //!< -1
+  //@}
+
+  //! Constructor
+  //@{
+  ZpzDom() : zero(0), one(1), mOne(-1), _p(0) {}
+  ZpzDom( Residu_t p ) : zero(0), one(1), mOne(p-1), _p(p) {}
+  ZpzDom( const ZpzDom<IntType>& F) : zero(F.zero), one(F.one), mOne(F.mOne),_p(F._p) { }
+  //@}
+
+  //! Copy
+  ZpzDom<IntType>& operator=( const ZpzDom<IntType>& F)
+  {
+	  F.assign(const_cast<Element&>(one),F.one);
+	  F.assign(const_cast<Element&>(zero),F.zero);
+	  F.assign(const_cast<Element&>(mOne),F.mOne);
 
 
-  int operator==( const ZpzDom<Integer>& BC) const { return _p == BC._p;}
-  int operator!=( const ZpzDom<Integer>& BC) const { return _p != BC._p;}
-
-  ZpzDom<Integer>& operator=( const ZpzDom<Integer>& F) {
       this->_p = F._p;
       return *this;
   }
 
-  // ----- Access to the modulus
+  //! (in)Equality
+  //@{
+  int operator==( const ZpzDom<IntType>& BC) const { return _p == BC._p;}
+  int operator!=( const ZpzDom<IntType>& BC) const { return _p != BC._p;}
+
+  // ----- Equality between two Elements
+
+  int areEqual(const  Rep& a, const Rep& b) const { return a==b;}
+  //@}
+
+  //! Access to the modulus
+  //@{
   Residu_t residu() const;
   Residu_t size() const {return _p;}
   Rep access( const Rep& a ) const { return a; }
   Residu_t characteristic() const { return _p; }
   Residu_t characteristic(Residu_t p) const { return p=_p; }
   Residu_t cardinality() const { return _p; }
+  //@}
 
 
-  // ----- Access to the modulus
+  //! Init a representation.
+  //@{
   Rep& init( Rep& a ) const;
   void init( const size_t, Array a, constArray b ) const;
-  Rep& init( Rep& r , const long a) const ;
-  Rep& init( Rep& r , const unsigned long a) const ;
+  Rep& init( Rep& r , const long int a) const ;
+  Rep& init( Rep& r , const unsigned long int a) const ;
   Rep& init( Rep& a, const int i) const ;
   Rep& init( Rep& a, const unsigned int i) const ;
-  Rep& init( Rep& a, const Integer& i) const ;
+  Rep& init( Rep& a, const IntType& i) const ;
 
 
   // Initialisation from double ( added for FFLAS usage) (C Pernet)
   Rep& init( Rep& a, const double i) const;
   Rep& init( Rep& a, const float i) const;
-  // Conversion to double ( added for FFLAS usage) (C Pernet)
+  //@}
+
+  //! Conversion
+  //@{
+  //to double ( added for FFLAS usage) (C Pernet)
   float& convert(float& r, const Rep& a ) const { return r = (float)a ;}
   double& convert(double& r, const Rep& a ) const { return r = (double)a ;}
   long int& convert(long int& r, const Rep& a) const { return r = (long int)a;}
   unsigned long int& convert(unsigned long int& r, const Rep& a) const { return r = (unsigned long int)a;
   }
-  Integer& convert(Integer& i, const Rep& a) const {
+  IntType& convert(IntType& i, const Rep& a) const {
       return i = a;
   }
+  //@}
 
-  // ----- Misc methods
+  //! Misc methods
+  //@{
   int isZero( const Rep& a ) const;
   int isOne ( const Rep& a ) const;
   size_t length ( const Rep& a ) const;
+  //@}
 
-  // ----- Equality between two Elements
-  int areEqual(const  Rep& a, const Rep& b) const { return a==b;}
 
-  // ----- Operations with reduction: r <- a op b mod p, r <- op a mod p
+  //! Operations with reduction: r <- a op b mod p, r <- op a mod p
+  //@{
   Rep& mul (Rep& r, const Rep& a, const Rep& b) const;
   Rep& div (Rep& r, const Rep& a, const Rep& b) const;
   Rep& add (Rep& r, const Rep& a, const Rep& b) const;
@@ -153,8 +180,10 @@ public:
   // -- maxpyin: r <- r - a * x mod p
   Rep& maxpyin(Rep& r, const Rep& a, const Rep& b) const;
   void maxpyin (const size_t sz, Array r, constArray a, constArray x) const;
+  //@}
 
-  // -- Misc: r <- a mod p
+  //! Misc: r <- a mod p
+  //@{
   void assign ( const size_t sz, Array r, constArray a ) const;
 #if 0 /* JGD 26.10.99 */
   void assign ( Rep& r, const Rep& a) const;
@@ -168,6 +197,9 @@ public:
   Rep& assign ( Rep& r, const unsigned long a ) const;
   Rep& assign ( Rep& r, const short a ) const;
   Rep& assign ( Rep& r, const unsigned short a ) const;
+  //@}
+  //! Random
+  //@{
    // ----- random generators
 //     Rep& NONZEROGIVRANDOM(Rep&) const ;
 //     Rep& GIVRANDOM(Rep&) const ;
@@ -178,8 +210,11 @@ public:
     template< class RandIter > Rep& nonzerorandom(RandIter&, Rep& r, long s) const ;
     template< class RandIter > Rep& nonzerorandom(RandIter&, Rep& r, const Rep& b) const ;
 
-    typedef GIV_randIter< ZpzDom<Integer> , Rep > randIter;
+    typedef GIV_randIter< ZpzDom<IntType> , Rep > randIter;
+    //@}
 
+    //! Misc.
+    //@{
   // <- \sum_i a[i], return 1 if a.size() ==0,
   Rep& reduceadd ( Rep& r, const size_t sz, constArray a ) const;
 
@@ -195,24 +230,30 @@ public:
 
   // ----- a -> r % p: double to Rep % p
   void d2i ( const size_t sz, Array r, const double* a ) const;
+  //@}
 
-  // --- IO methods
+  //! IO methods
+  //@{
   std::istream& read ( std::istream& s );
   std::ostream& write( std::ostream& s ) const;
   std::istream& read ( std::istream& s, Rep& a ) const;
   std::ostream& write( std::ostream& s, const Rep& a ) const;
+  //@}
 
 protected:
-  // -- data representation of the domain:
+  //! data representation of the domain:
     Residu_t _p;
 
-    static void Init();
-    static void End();
+    //! @internal ??
+    //@{
+    static void Init(){}
+    static void End() {}
+    //@}
 };
 
 } // namespace Givaro
 
-#include "givaro/givzpzInt.inl"
+#include "givaro/givzpzGen.inl"
 
-#endif // __GIVARO_zpz_int_H
+#endif // __GIVARO_zpz_gen_H
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/zpz/givzpzGen.inl b/src/kernel/zpz/givzpzGen.inl
new file mode 100644
index 0000000..c79aec2
--- /dev/null
+++ b/src/kernel/zpz/givzpzGen.inl
@@ -0,0 +1,636 @@
+// ==========================================================================
+// $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givzpzGen.inl,v $
+// Copyright(c)'1994-2009 by The Givaro group
+// This file is part of Givaro.
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+// Authors: JG Dumas
+// $Id: givzpzGen.inl,v 1.11 2011-02-02 17:16:43 bboyer Exp $
+// ==========================================================================
+#ifndef __GIVARO_zpz_gen_INL
+#define __GIVARO_zpz_gen_INL
+// Description:
+
+// ---------
+// -- normalized operations
+// ---------
+
+// r = a*b
+// #define __GIVARO_ZPZIntType_N_MUL(r,p,a,b) { r = a*b % p; }
+#define __GIVARO_ZPZIntType_N_MUL(r,p,a,b) { r = a; r*=b; r %= p; }
+// r *= a
+//#define __GIVARO_ZPZIntType_N_MULIN(r,p,a) {  r = (r*a % p);  }
+#define __GIVARO_ZPZIntType_N_MULIN(r,p,a) {  r *= a; r %= p;  }
+
+// r = a - b
+//#define __GIVARO_ZPZIntType_N_SUB(r,p,a,b) { r = (a-b); r= (r < 0 ? r+p : r); }
+#define __GIVARO_ZPZIntType_N_SUB(r,p,a,b) { r = (a>=b) ? a-b: (p-b)+a ; }
+// r -= a
+// #define __GIVARO_ZPZIntType_N_SUBIN(r,p,a) { r -= a; r= (r < 0 ? r+p : r); }
+#define __GIVARO_ZPZIntType_N_SUBIN(r,p,a) { if (r<a) r+=(p-a); else r-=a; }
+
+// r = a+b
+// #define __GIVARO_ZPZIntType_N_ADD(r,p,a,b) { r = (a+b); r= (r < p ? r : r-p); }
+#define __GIVARO_ZPZIntType_N_ADD(r,p,a,b) { r = (a+b); if (r >= p) r-=p; }
+// r += a
+// #define __GIVARO_ZPZIntType_N_ADDIN(r,p,a) { r += a;  r= (r < p ? r : r-p); }
+#define __GIVARO_ZPZIntType_N_ADDIN(r,p,a) { r += a;  if (r >= p) r-=p; }
+
+// r <- a*b+c % p
+// #define __GIVARO_ZPZIntType_N_MULADD(r,p,a,b,c) { r = (a*b+c) % p;  }
+#define __GIVARO_ZPZIntType_N_MULADD(r,p,a,b,c) { r = a; r*=b; r+=c; r %= p;  }
+
+// #define __GIVARO_ZPZIntType_N_MULADDIN(r,p,a,b) { r = (a*b+r) % p;  }
+#define __GIVARO_ZPZIntType_N_MULADDIN(r,p,a,b) { r += (a*b); r %= p;  }
+
+// a*b-c
+//#define __GIVARO_ZPZIntType_N_MULSUB(r,p,a,b,c) { r = (a*b+p-c); r= (r<p ? r : r % p);  }
+#define __GIVARO_ZPZIntType_N_MULSUB(r,p,a,b,c) { r = a*b; r+=p; r-=c; r= (r<p ? r : r % p);  }
+// a*b-c
+//#define __GIVARO_ZPZIntType_N_SUBMULIN(r,p,a,b) { r -= (a*b); if (r<0) { r+=p; r = (r<0 ? r % p : r); } }
+#define __GIVARO_ZPZIntType_N_SUBMULIN(r,p,a,b) { r = p-r; r += a*b; r= (r<p ? r : r % p); __GIVARO_ZPZIntType_N_NEGIN(r,p); }
+
+#define __GIVARO_ZPZIntType_N_NEG(r,p,a) { r = ( isZero(a) ? zero : p-a); }
+#define __GIVARO_ZPZIntType_N_NEGIN(r,p) { r = ( isZero(r) ? zero : p-r); }
+
+namespace Givaro {
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Residu_t ZpzDom<IntType>::residu( ) const
+{ return _p; }
+
+
+
+ // ------------------------- Miscellaneous functions
+
+template<typename IntType>
+inline int ZpzDom<IntType>::isZero(const Rep& a) const
+{ return a == zero; }
+
+template<typename IntType>
+inline int ZpzDom<IntType>::isOne(const Rep& a) const
+{ return a == one; }
+
+
+
+template<typename IntType>
+inline size_t ZpzDom<IntType>::length(const Rep& a) const
+{ return ZpzDom<IntType>::size_rep;}
+
+
+
+ // ------------------------- Arithmetic functions
+
+
+
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::mul (Rep& r,
+							    const Rep& a, const Rep& b) const
+{
+    __GIVARO_ZPZIntType_N_MUL(r,_p,a,b); return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::sub (Rep& r,
+							    const Rep& a, const Rep& b) const
+{
+  __GIVARO_ZPZIntType_N_SUB(r,_p,a,b); return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::add (Rep& r,
+							    const Rep& a, const Rep& b) const
+{
+    __GIVARO_ZPZIntType_N_ADD(r,_p,a,b); return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::neg (Rep& r,
+							    const Rep& a) const
+{
+    __GIVARO_ZPZIntType_N_NEG(r,_p,a); return r;
+
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::negin (Rep& r) const
+{
+  __GIVARO_ZPZIntType_N_NEGIN(r,_p);
+  return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::inv (Rep& u1,
+							    const Rep& a) const
+{
+    u1=one;
+    IntType r0(_p), r1(a);
+    IntType q(r0/r1);
+
+    r0 -= q * r1;
+    if (r0 == zero) return u1;
+    IntType u0 = q;
+
+    q = r1/r0;
+    r1 -= q * r0;
+
+    while (r1 != zero) {
+        u1 += q * u0;
+
+        q = r0/r1;
+        r0 -= q * r1;
+        if (r0 == zero) return u1;
+        u0 += q * u1;
+
+        q = r1/r0;
+        r1 -= q * r0;
+
+    };
+
+    return u1=_p-u0;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::div (Rep& r,
+							    const Rep& a, const Rep& b) const
+{
+  typename ZpzDom<IntType>::Rep ib;
+  inv(ib, b);
+  __GIVARO_ZPZIntType_N_MUL(r,_p,a,ib);
+  return r;
+}
+
+ // -- inline array operations between typename ZpzDom<IntType>::Rep
+template<typename IntType>
+inline void ZpzDom<IntType>::mul (const size_t sz, Array r, constArray a, constArray b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_MUL(r[i], _p,a[i], b[i]);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::mul (const size_t sz,
+				  Array r, constArray a, const Rep& b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_MUL(r[i], _p, a[i], b);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::div (const size_t sz, Array r, constArray a, constArray b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    div( r[i], a[i], b[i]);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::div (const size_t sz, Array r, constArray a,
+				  const Rep& b) const
+{
+  typename ZpzDom<IntType>::Rep ib;
+  inv(ib, b);
+  mul(sz, r, a, ib);
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::add (const size_t sz, Array r, constArray a, constArray b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_ADD(r[i], _p, a[i], b[i]);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::add (const size_t sz, Array r, constArray a,
+				  const Rep& b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_ADD(r[i], _p, a[i], b);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::sub (const size_t sz, Array r, constArray a, constArray b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_SUB(r[i], _p, a[i], b[i]);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::sub (const size_t sz, Array r, constArray a,
+				  const Rep& b) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_SUB(r[i], _p, a[i], b);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::neg (const size_t sz, Array r, constArray a) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_NEG(r[i], _p, a[i]);
+  }
+}
+
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::mulin (Rep& r,
+							      const Rep& a) const
+{
+  __GIVARO_ZPZIntType_N_MULIN(r,_p, a);
+  return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::divin (Rep& r,
+							      const Rep& a) const
+{
+  typename ZpzDom<IntType>::Rep ia;
+  inv(ia, a);
+  return mulin(r, ia);
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::addin (Rep& r,
+							      const Rep& a) const
+{
+  __GIVARO_ZPZIntType_N_ADDIN(r,_p, a);
+  return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::subin (Rep& r,
+							      const Rep& a) const
+{
+  __GIVARO_ZPZIntType_N_SUBIN(r,_p, a);
+  return r;
+}
+
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::invin (Rep& r) const
+{
+   typename ZpzDom<IntType>::Rep t = r;
+   return ZpzDom<IntType>::inv(r,t);
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::axpy (Rep& r,
+						    const Rep& a, const Rep& b, const Rep& c) const
+{
+  __GIVARO_ZPZIntType_N_MULADD(r, _p, a, b, c);
+  return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::axpyin (Rep& r,
+						       const Rep& a, const Rep& b) const
+{
+  typename ZpzDom<IntType>::Rep tmp = r;
+  __GIVARO_ZPZIntType_N_MULADDIN(tmp, _p, a, b);
+  return r = (Rep)tmp;
+}
+
+
+template<typename IntType>
+inline void ZpzDom<IntType>::axpy (const size_t sz, Array r,
+				   constArray a, constArray x, constArray y) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_MULADD(r[i], _p, a[i], x[i], y[i]);
+  }
+}
+
+template<typename IntType>
+inline void ZpzDom<IntType>::axpyin (const size_t sz, Array r,
+				     constArray a, constArray x) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    typename ZpzDom<IntType>::Rep tmp = r[i];
+    __GIVARO_ZPZIntType_N_MULADDIN(tmp, _p, a[i], x[i]);
+    r[i] = (Rep)tmp;
+  }
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::axmy (Rep& r,
+						     const Rep& a, const Rep& b, const Rep& c) const
+{
+  __GIVARO_ZPZIntType_N_MULSUB(r, _p, a, b, c);
+  return r;
+}
+
+// r = c - a*b
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::maxpy (Rep& r,
+						      const Rep& a, const Rep& b, const Rep& c) const
+{
+  typename ZpzDom<IntType>::Rep tmp = c;
+  __GIVARO_ZPZIntType_N_SUBMULIN(tmp, _p, a, b );
+  return r = (Rep)tmp;
+}
+// r -= a*b
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::maxpyin (Rep& r,
+						       	const Rep& a, const Rep& b) const
+{
+  __GIVARO_ZPZIntType_N_SUBMULIN(r, _p, a, b );
+  return r;
+//   typename ZpzDom<IntType>::Rep tmp = r;
+//   __GIVARO_ZPZIntType_N_SUBMULIN(tmp, _p, a, b );
+//   return r = (Rep)tmp;
+}
+// r = a*b - r
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::axmyin (Rep& r,
+						       const Rep& a, const Rep& b) const
+{
+    maxpyin(r,a,b);
+    return negin(r);
+}
+
+
+template<typename IntType>
+inline void ZpzDom<IntType>::axmy (const size_t sz, Array r,
+				   constArray a, constArray x, constArray y) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    __GIVARO_ZPZIntType_N_MULSUB(r[i], _p, a[i], x[i], y[i]);
+  }
+}
+
+// r -= a*b
+template<typename IntType>
+inline void ZpzDom<IntType>::maxpyin (const size_t sz, Array r,
+				     constArray a, constArray x) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    typename ZpzDom<IntType>::Rep tmp = r[i];
+    __GIVARO_ZPZIntType_N_SUBMULIN(tmp, _p, a[i], x[i]);
+    r[i] = (Rep)tmp;
+  }
+}
+
+
+// ---------
+// -- misc operations
+// ---------
+
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::init ( Rep& r, const double a ) const
+{
+  int sign; double ua;
+  if (a < 0.0) { sign =-1; ua = -a;}
+  else { ua = a; sign =1; }
+  r = IntType(ua);
+  if (r >=_p) r %= _p;
+  if (!isZero(r) && (sign == -1)) r = _p - r;
+  return r;
+}
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::init ( Rep& r, const float a ) const
+{
+    return init(r, (double)a);
+}
+
+
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::init ( Rep& r, const unsigned long int a ) const
+{
+    r = IntType(a);
+    if ( r >= _p ) r %= _p;
+    return r ;
+}
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::init ( Rep& r, const long int a ) const
+{
+  int sign;
+  if (a <0) { sign =-1; r = IntType(-a);}
+  else { r = IntType(a); sign =1; }
+  if (r >=_p) r %= _p;
+  if (!isZero(r) && (sign ==-1)) r = _p - r;
+  return r;
+}
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::init ( Rep& r, const IntType& a ) const
+{
+  int sign;
+  if (a < zero) { sign =-1; r = IntType(-a);}
+  else { r = IntType(a); sign =1; }
+  if (r >=_p) r %= _p;
+  if (!isZero(r) && (sign ==-1)) r = _p - r;
+  return r;
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::init( Rep& a, const int i) const { return init(a,(long)i); }
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::init( Rep& a, const unsigned int i) const { return init(a,(unsigned long)i); }
+
+
+template<typename IntType>
+inline void ZpzDom<IntType>::assign
+  ( const size_t sz, Array r, constArray a ) const
+{
+  for ( size_t i=sz ; --i ; ) {
+    if (a[i] <ZpzDom<IntType>::zero) {
+       r[i] = a[i] + _p;
+       if (r[i] <ZpzDom<IntType>::zero) r[i] %= _p;
+    }
+    else if (a[i] >_p) {
+       r[i] = a[i] - _p;
+       if (r[i] >=_p) r[i] %= _p;
+    }
+    else r[i] = a[i];
+  }
+}
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::assign ( Rep& r, const long a ) const
+{
+  return r = typename ZpzDom<IntType>::Rep(a);
+}
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::assign ( Rep& r, const short a ) const
+{ return ZpzDom<IntType>::assign( r, (long)a); }
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::assign ( Rep& r, const unsigned long a ) const
+{ return r = typename ZpzDom<IntType>::Rep(a); }
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::assign
+  ( Rep& r, const unsigned short a ) const
+{ return r = typename ZpzDom<IntType>::Rep(a); }
+
+template<typename IntType>
+inline  typename ZpzDom<IntType>::Rep&  ZpzDom<IntType>::assign
+  ( Rep& r, const Rep& a ) const
+{ return r=a; }
+
+
+template<typename IntType>
+inline void ZpzDom<IntType>::init
+  ( const size_t sz, Array r, constArray a ) const
+{
+  for ( size_t i=sz ; --i ; )
+       r[i] = a[i];
+}
+
+template<typename IntType>
+inline typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::init ( Rep& r ) const
+{ return r = zero; }
+
+
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::random(RandIter& g,
+							       Rep& a) const {
+	        return init(a, g());
+}
+
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::random(RandIter& g,
+							       Rep& a, const Rep& b) const {
+	        IntType::random(a,b);
+                return a %= _p;
+}
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::random(RandIter& g,
+							       Rep& a, long b) const {
+	        IntType::random(a,b);
+	        return a %= _p;
+
+}
+
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::nonzerorandom(RandIter& g,
+								      Rep& a) const {
+	        while (isZero( random(g,a) )) {};
+		return a;
+}
+
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::nonzerorandom(RandIter& g,
+								      Rep& a, const Rep& b) const {
+	        while (isZero( random(g,a,b))) {};
+		return a;
+}
+
+template<typename IntType>
+template< class RandIter >
+inline  typename ZpzDom<IntType>::Rep& ZpzDom<IntType>::nonzerorandom(RandIter& g,
+								      Rep& a, long b) const {
+	        while (isZero( random(g,a,b))) {};
+		return a;
+}
+
+
+  //  a -> r: int32_t to double
+template<typename IntType>
+inline void
+  ZpzDom<IntType>::i2d ( const size_t sz, double* r, constArray a ) const
+{
+  for (size_t i=0; i<sz; ++i) r[i] = a[i];
+}
+
+  //  a -> r: double to int32_t
+template<typename IntType>
+inline void
+  ZpzDom<IntType>::d2i ( const size_t sz, Array r, const double* a ) const
+{
+  union d_2_l {
+    double d;
+    int32_t r[2];
+  };
+//  static const double offset = 4503599627370496.0; // 2^52
+  double offset = 4503599627370496.0; // 2^52
+  for (size_t i=0; i<sz; ++i)
+  {
+       d_2_l tmp;
+      // - normalization: put fractional part at the end of the representation
+      tmp.d = a[i] + offset;
+      r[i] = tmp.r[1];
+      if (r[i] <_p) r[i] %= _p;
+  }
+  //    r[i] = (tmp.r[1] <_p ? tmp.r[1] : tmp.r[1]-_p);
+  //    r[i] = (r[i] <_p ? r[i] : r[i]%_p);
+  //    r[i] = (tmp.r[1] <_p ? tmp.r[1] : tmp.r[1]%_p);
+}
+
+
+
+ // -- Input: (z, <_p>)
+template<typename IntType>
+inline std::istream& ZpzDom<IntType>::read (std::istream& s)
+{
+  char ch;
+  s >> std::ws >> ch;
+  if (ch != '(')
+//    GivError::throw_error( GivBadFormat("ZpzDom<IntType>::read: syntax error: no '('"));
+    std::cerr << "GivBadFormat(ZpzDom<IntType>::read: syntax error: no '('))" << std::endl;
+
+  s >> std::ws >> ch;
+  if (ch != 'z')
+//    GivError::throw_error( GivBadFormat("ZpzDom<IntType>::read: bad domain object"));
+    std::cerr << "GivBadFormat(ZpzDom<IntType>::read: bad domain object))" << std::endl;
+
+  s >> std::ws >> ch;
+  if (ch != ',')
+//    GivError::throw_error( GivBadFormat("ZpzDom<IntType>::read: syntax error: no ','"));
+    std::cerr << "GivBadFormat(ZpzDom<IntType>::read: syntax error: no ',')) " << std::endl;
+
+  s >> std::ws >> _p;
+
+  s >> std::ws >> ch;
+  if (ch != ')')
+//    GivError::throw_error( GivBadFormat("ZpzDom<IntType>::read: syntax error: no ')'"));
+    std::cerr << "GivBadFormat(ZpzDom<IntType>::read: syntax error: no ')')) " << std::endl;
+
+  return s;
+}
+
+template<typename IntType>
+inline std::ostream& ZpzDom<IntType>::write (std::ostream& s ) const
+{
+  return s << "(z," << residu() << ')';
+}
+
+template<typename IntType>
+inline std::istream& ZpzDom<IntType>::read (std::istream& s,
+					    Rep& a) const
+{
+  s >> a;
+  init(a, a);
+  return s;
+}
+
+template<typename IntType>
+inline std::ostream& ZpzDom<IntType>::write (std::ostream& s,
+					     const Rep& a) const
+{
+  return s << a;
+}
+
+} // namespace Givaro
+
+#endif // __GIVARO_zpz_gen_INL
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
diff --git a/src/kernel/zpz/givzpzInt.C b/src/kernel/zpz/givzpzInt.C
deleted file mode 100644
index 9a7ded0..0000000
--- a/src/kernel/zpz/givzpzInt.C
+++ /dev/null
@@ -1,29 +0,0 @@
-// ==========================================================================
-// $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givzpzInt.C,v $
-// Copyright(c)'1994-2009 by The Givaro group
-// This file is part of Givaro.
-// Givaro is governed by the CeCILL-B license under French law
-// and abiding by the rules of distribution of free software.
-// see the COPYRIGHT file for more details.
-// Authors: JG Dumas
-// $Id: givzpzInt.C,v 1.2 2009-09-17 14:28:23 jgdumas Exp $
-// ==========================================================================
-// Description:
-
-#include <iostream>
-#include "givaro/givzpzInt.h"
-
-namespace Givaro {
-
-void ZpzDom<Integer>::Init()
-{
-}
-
-void ZpzDom<Integer>::End()
-{
-}
-
-
-
-} // namespace Givaro
-
diff --git a/src/kernel/zpz/givzpzInt.h b/src/kernel/zpz/givzpzInt.h
index d41ce81..59313f3 100644
--- a/src/kernel/zpz/givzpzInt.h
+++ b/src/kernel/zpz/givzpzInt.h
@@ -9,7 +9,7 @@
 // $Id: givzpzInt.h,v 1.11 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
 
-/*! @file zpz/givzpzInt.h
+/*! @file givzpzInt.h
  * @ingroup zpz
  *  @brief Arithmetic on Z/pZ, with p a prime number in arbitrary precision.
  */
@@ -30,7 +30,6 @@ namespace Givaro {
  * - The representation of an integer a in Zpz is the value a % p
  * .
  */
-
 template<>
 class ZpzDom<Integer> {
 public:
@@ -48,17 +47,23 @@ public:
   // ----- Constantes
   const Rep zero;
   const Rep one;
+  const Rep mOne;
 
   // ----- Constructor
-  ZpzDom() : zero(0), one(1), _p(0) {}
-  ZpzDom( Residu_t p ) : zero(0), one(1), _p(p) {}
-  ZpzDom( const ZpzDom<Integer>& F) : zero(0), one(1), _p(F._p) { }
+  ZpzDom() : zero(0), one(1), mOne(-1), _p(0) {}
+  ZpzDom( Residu_t p ) : zero(0), one(1), mOne(p-1), _p(p) {}
+  ZpzDom( const ZpzDom<Integer>& F) : zero(F.zero), one(F.one), mOne(F.mOne),_p(F._p) { }
 
 
   int operator==( const ZpzDom<Integer>& BC) const { return _p == BC._p;}
   int operator!=( const ZpzDom<Integer>& BC) const { return _p != BC._p;}
 
   ZpzDom<Integer>& operator=( const ZpzDom<Integer>& F) {
+	  F.assign(const_cast<Element&>(one),F.one);
+	  F.assign(const_cast<Element&>(zero),F.zero);
+	  F.assign(const_cast<Element&>(mOne),F.mOne);
+
+
       this->_p = F._p;
       return *this;
   }
diff --git a/src/kernel/zpz/givzpzInt.inl b/src/kernel/zpz/givzpzInt.inl
index abe107b..b1c2117 100644
--- a/src/kernel/zpz/givzpzInt.inl
+++ b/src/kernel/zpz/givzpzInt.inl
@@ -18,41 +18,47 @@
 
 // r = a*b
 // #define __GIVARO_ZPZInteger_N_MUL(r,p,a,b) { r = a*b % p; }
-#define __GIVARO_ZPZInteger_N_MUL(r,p,a,b) { r = a; r*=b; r %= p; }
+#define __GIVARO_ZPZInteger_N_MUL(r,p,a,b) { Integer::mul(r,a,b); Integer::modin(r,p); }
 // r *= a
 //#define __GIVARO_ZPZInteger_N_MULIN(r,p,a) {  r = (r*a % p);  }
-#define __GIVARO_ZPZInteger_N_MULIN(r,p,a) {  r *= a; r %= p;  }
+#define __GIVARO_ZPZInteger_N_MULIN(r,p,a) {  Integer::mulin(r,a); Integer::modin(r,p);  }
 
 // r = a - b
 //#define __GIVARO_ZPZInteger_N_SUB(r,p,a,b) { r = (a-b); r= (r < 0 ? r+p : r); }
-#define __GIVARO_ZPZInteger_N_SUB(r,p,a,b) { r = (a-b); if (r < 0 ) r+=p; }
+#define __GIVARO_ZPZInteger_N_SUB(r,p,a,b) { Integer::sub(r,a,b); if (sign(r) < 0) Integer::addin(r,p); }
 // r -= a
 // #define __GIVARO_ZPZInteger_N_SUBIN(r,p,a) { r -= a; r= (r < 0 ? r+p : r); }
-#define __GIVARO_ZPZInteger_N_SUBIN(r,p,a) { r -= a; if (r < 0 ) r+=p; }
+#define __GIVARO_ZPZInteger_N_SUBIN(r,p,a) { Integer::subin(r,a) ; if ( sign(r) < 0) Integer::addin(r,p); }
 
 // r = a+b
 // #define __GIVARO_ZPZInteger_N_ADD(r,p,a,b) { r = (a+b); r= (r < p ? r : r-p); }
-#define __GIVARO_ZPZInteger_N_ADD(r,p,a,b) { r = (a+b); if (r >= p) r-=p; }
+#define __GIVARO_ZPZInteger_N_ADD(r,p,a,b) { Integer::add(r,a,b); if (r >= p) Integer::subin(r,p); }
 // r += a
 // #define __GIVARO_ZPZInteger_N_ADDIN(r,p,a) { r += a;  r= (r < p ? r : r-p); }
-#define __GIVARO_ZPZInteger_N_ADDIN(r,p,a) { r += a;  if (r >= p) r-=p; }
+#define __GIVARO_ZPZInteger_N_ADDIN(r,p,a) { Integer::addin(r,a);  if (r >= p) Integer::subin(r,p); }
 
 // r <- a*b+c % p
 // #define __GIVARO_ZPZInteger_N_MULADD(r,p,a,b,c) { r = (a*b+c) % p;  }
-#define __GIVARO_ZPZInteger_N_MULADD(r,p,a,b,c) { r = a; r*=b; r+=c; r %= p;  }
+//#define __GIVARO_ZPZInteger_N_MULADD(r,p,a,b,c) { r = a; r*=b; r+=c; r %= p;  }
+#define __GIVARO_ZPZInteger_N_MULADD(r,p,a,b,c) { Integer::axpy(r,a,b,c); Integer::modin(r,p);  }
 
 // #define __GIVARO_ZPZInteger_N_MULADDIN(r,p,a,b) { r = (a*b+r) % p;  }
-#define __GIVARO_ZPZInteger_N_MULADDIN(r,p,a,b) { r += (a*b); r %= p;  }
+//#define __GIVARO_ZPZInteger_N_MULADDIN(r,p,a,b) { r += (a*b); r %= p;  }
+#define __GIVARO_ZPZInteger_N_MULADDIN(r,p,a,b) { Integer::axpyin(r,a,b); Integer::modin(r,p); }
 
 // a*b-c
 //#define __GIVARO_ZPZInteger_N_MULSUB(r,p,a,b,c) { r = (a*b+p-c); r= (r<p ? r : r % p);  }
-#define __GIVARO_ZPZInteger_N_MULSUB(r,p,a,b,c) { r = a; r*=b; r+=p; r-=c; if (r>=p) r %= p;  }
+//#define __GIVARO_ZPZInteger_N_MULSUB(r,p,a,b,c) { r = a; r*=b; r+=p; r-=c; if (r>=p) r %= p;  }
+#define __GIVARO_ZPZInteger_N_MULSUB(r,p,a,b,c) { Integer::axmy(r,a,b,c); Integer::modin(r,p);  }
 // a*b-c
 //#define __GIVARO_ZPZInteger_N_SUBMULIN(r,p,a,b) { r -= (a*b); if (r<0) { r+=p; r = (r<0 ? r % p : r); } }
-#define __GIVARO_ZPZInteger_N_SUBMULIN(r,p,a,b) { r -= (a*b); if (r<0) { r+=p; if (r<0 ) r %= p ; if (r<0 ) r += p ; } }
+// #define __GIVARO_ZPZInteger_N_SUBMULIN(r,p,a,b) { r -= (a*b); if (r<0) { r+=p; if (r<0 ) r %= p ; if (r<0 ) r += p ; } }
+#define __GIVARO_ZPZInteger_N_SUBMULIN(r,p,a,b) { Integer::maxpyin(r,a,b); Integer::modin(r,p) ; }
 
-#define __GIVARO_ZPZInteger_N_NEG(r,p,a) { r = ( isZero(a) ? zero : p-a); }
-#define __GIVARO_ZPZInteger_N_NEGIN(r,p) { r = ( isZero(r) ? zero : p-r); }
+// #define __GIVARO_ZPZInteger_N_NEG(r,p,a) { r = ( isZero(a) ? zero : p-a); }
+#define __GIVARO_ZPZInteger_N_NEG(r,p,a) { if (isZero(a)) r=a; else Integer::sub(r,p,a);  }
+// #define __GIVARO_ZPZInteger_N_NEGIN(r,p) { r = ( isZero(r) ? zero : p-r); }
+#define __GIVARO_ZPZInteger_N_NEGIN(r,p) { if (! isZero(r)) Integer::sub(r,p,r); }
 
 namespace Givaro {
 
@@ -238,9 +244,11 @@ inline ZpzDom<Integer>::Rep& ZpzDom<Integer>::axpy (Rep& r,
 inline ZpzDom<Integer>::Rep&  ZpzDom<Integer>::axpyin (Rep& r,
 						       const Rep& a, const Rep& b) const
 {
-  Rep tmp = r;
-  __GIVARO_ZPZInteger_N_MULADDIN(tmp, _p, a, b);
-  return r = (ZpzDom<Integer>::Rep)tmp;
+//   Rep tmp = r;
+//   __GIVARO_ZPZInteger_N_MULADDIN(tmp, _p, a, b);
+//   return r = (ZpzDom<Integer>::Rep)tmp;
+    __GIVARO_ZPZInteger_N_MULADDIN(r, _p, a, b);
+    return r;
 }
 
 
@@ -256,9 +264,10 @@ inline void ZpzDom<Integer>::axpyin (const size_t sz, Array r,
 				     constArray a, constArray x) const
 {
   for ( size_t i=sz ; --i ; ) {
-    Rep tmp = r[i];
-    __GIVARO_ZPZInteger_N_MULADDIN(tmp, _p, a[i], x[i]);
-    r[i] = (ZpzDom<Integer>::Rep)tmp;
+//     Rep tmp = r[i];
+//     __GIVARO_ZPZInteger_N_MULADDIN(tmp, _p, a[i], x[i]);
+//     r[i] = (ZpzDom<Integer>::Rep)tmp;
+    __GIVARO_ZPZInteger_N_MULADDIN(r[i], _p, a[i], x[i]);
   }
 }
 
@@ -309,9 +318,10 @@ inline void ZpzDom<Integer>::maxpyin (const size_t sz, Array r,
 				     constArray a, constArray x) const
 {
   for ( size_t i=sz ; --i ; ) {
-    Rep tmp = r[i];
-    __GIVARO_ZPZInteger_N_SUBMULIN(tmp, _p, a[i], x[i]);
-    r[i] = (ZpzDom<Integer>::Rep)tmp;
+//     Rep tmp = r[i];
+//     __GIVARO_ZPZInteger_N_SUBMULIN(tmp, _p, a[i], x[i]);
+//     r[i] = (ZpzDom<Integer>::Rep)tmp;
+    __GIVARO_ZPZInteger_N_SUBMULIN(r[i], _p, a[i], x[i]);
   }
 }
 
@@ -327,8 +337,8 @@ inline  ZpzDom<Integer>::Rep&  ZpzDom<Integer>::init ( Rep& r, const double a )
   if (a < 0.0) { sign =-1; ua = -a;}
   else { ua = a; sign =1; }
   r = Integer(ua);
-  if (r >=_p) r %= _p;
-  if (!isZero(r) && (sign == -1)) r = _p - r;
+  if (r >=_p) Integer::modin(r,_p) ;
+  if (!isZero(r) && (sign == -1)) Integer::sub(r,_p,r) ;
   return r;
 }
 
@@ -341,7 +351,7 @@ inline  ZpzDom<Integer>::Rep&  ZpzDom<Integer>::init ( Rep& r, const float a ) c
 inline  ZpzDom<Integer>::Rep&  ZpzDom<Integer>::init ( Rep& r, const unsigned long a ) const
 {
     r = Integer(a);
-    if ( r >= _p ) r %= _p;
+    if ( r >= _p ) Integer::modin(r,_p);
     return r ;
 }
 
@@ -350,8 +360,8 @@ inline  ZpzDom<Integer>::Rep&  ZpzDom<Integer>::init ( Rep& r, const long a ) co
   int sign;
   if (a <0) { sign =-1; r = Integer(-a);}
   else { r = Integer(a); sign =1; }
-  if (r >=_p) r %= _p;
-  if (!isZero(r) && (sign ==-1)) r = _p - r;
+  if (r >=_p) Integer::modin(r,_p);
+  if (!isZero(r) && (sign ==-1)) Integer::sub(r,_p,r);
   return r;
 }
 
@@ -360,8 +370,8 @@ inline  ZpzDom<Integer>::Rep&  ZpzDom<Integer>::init ( Rep& r, const Integer& a
   int sign;
   if (a <0) { sign =-1; r = Integer(-a);}
   else { r = Integer(a); sign =1; }
-  if (r >=_p) r %= _p;
-  if (!isZero(r) && (sign ==-1)) r = _p - r;
+  if (r >=_p) Integer::modin(r,_p);
+  if (!isZero(r) && (sign ==-1)) Integer::sub(r, _p, r);
   return r;
 }
 
@@ -375,12 +385,12 @@ inline void ZpzDom<Integer>::assign
 {
   for ( size_t i=sz ; --i ; ) {
     if (a[i] <ZpzDom<Integer>::zero) {
-       r[i] = a[i] + _p;
-       if (r[i] <ZpzDom<Integer>::zero) r[i] %= _p;
+	    Integer::add(r[i], a[i], _p);
+       if (r[i] <ZpzDom<Integer>::zero) Integer::modin(r[i], _p);
     }
     else if (a[i] >_p) {
-       r[i] = a[i] - _p;
-       if (r[i] >=_p) r[i] %= _p;
+	    Integer::sub(r[i],a[i],_p);
+       if (r[i] >=_p) Integer::modin(r[i],_p);
     }
     else r[i] = a[i];
   }
@@ -425,12 +435,12 @@ inline  ZpzDom<Integer>::Rep& ZpzDom<Integer>::random(RandIter& g, Rep& a) const
 template< class RandIter >
 inline  ZpzDom<Integer>::Rep& ZpzDom<Integer>::random(RandIter& g, Rep& a, const Rep& b) const {
 	        Integer::random(a,b);
-                return a %= _p;
+                return Integer::modin(a,_p);
 }
 template< class RandIter >
 inline  ZpzDom<Integer>::Rep& ZpzDom<Integer>::random(RandIter& g, Rep& a, long b) const {
 	        Integer::random(a,b);
-	        return a %= _p;
+	        return Integer::modin(a,_p);
 
 }
 
@@ -476,7 +486,7 @@ inline void
       // - normalization: put fractional part at the end of the representation
       tmp.d = a[i] + offset;
       r[i] = tmp.r[1];
-      if (r[i] <_p) r[i] %= _p;
+      if (r[i] <_p) Integer::modin(r[i],_p);
   }
   //    r[i] = (tmp.r[1] <_p ? tmp.r[1] : tmp.r[1]-_p);
   //    r[i] = (r[i] <_p ? r[i] : r[i]%_p);
diff --git a/src/kernel/zpz/givzpztypes.h b/src/kernel/zpz/givzpztypes.h
index 35dbc7f..6b35cf8 100644
--- a/src/kernel/zpz/givzpztypes.h
+++ b/src/kernel/zpz/givzpztypes.h
@@ -1,7 +1,7 @@
 // ==========================================================================
 // $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givzpztypes.h,v $
 // Copyright(c)'1994-2011 by The Givaro group
-// Time-stamp: <02 Feb 11 14:36:21 Jean-Guillaume.Dumas at imag.fr>        //
+// Time-stamp: <15 Mar 12 10:36:28 Jean-Guillaume.Dumas at imag.fr>        //
 // This file is part of Givaro.
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
@@ -9,7 +9,7 @@
 // Authors: JG Dumas
 // ==========================================================================
 
-/*! @file zpz/givzpztypes.h
+/*! @file givzpztypes.h
  * @ingroup zpz
  * @brief  Family of types for arithmetic over Zpz.
  */
diff --git a/src/kernel/zpz/zpz.doxy b/src/kernel/zpz/zpz.doxy
new file mode 100644
index 0000000..cd76021
--- /dev/null
+++ b/src/kernel/zpz/zpz.doxy
@@ -0,0 +1,7 @@
+/** @degroup zpz Zpz
+ * @ingroup givaro
+* @brief Z/pZ.
+* NO DOC
+*/
+
+// vim:syn=doxygen
diff --git a/src/library/Makefile.in b/src/library/Makefile.in
index 8130201..0182e15 100644
--- a/src/library/Makefile.in
+++ b/src/library/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,9 +21,27 @@
 # and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -56,6 +74,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
@@ -67,12 +86,45 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -102,6 +154,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -137,6 +190,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -211,9 +265,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/library/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/library/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/library/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/library/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -231,6 +285,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -262,7 +317,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -296,16 +351,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -320,7 +375,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -332,7 +387,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -341,29 +396,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -384,29 +444,41 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -426,16 +498,22 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -506,8 +584,8 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic clean-libtool \
@@ -523,6 +601,7 @@ uninstall-am:
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
 	uninstall uninstall-am
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/library/matrix/Makefile.in b/src/library/matrix/Makefile.in
index b2d06dd..1004446 100644
--- a/src/library/matrix/Makefile.in
+++ b/src/library/matrix/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivmatrix_la_LIBADD =
 am_libgivmatrix_la_OBJECTS = givmatrix.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivmatrix_la_SOURCES)
 DIST_SOURCES = $(libgivmatrix_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -243,9 +289,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/library/matrix/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/library/matrix/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/library/matrix/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/library/matrix/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -263,6 +309,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -272,7 +319,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivmatrix.la: $(libgivmatrix_la_OBJECTS) $(libgivmatrix_la_DEPENDENCIES) 
+libgivmatrix.la: $(libgivmatrix_la_OBJECTS) $(libgivmatrix_la_DEPENDENCIES) $(EXTRA_libgivmatrix_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivmatrix_la_OBJECTS) $(libgivmatrix_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -297,21 +344,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -325,7 +376,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -333,29 +384,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -376,13 +432,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -403,16 +463,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -502,6 +568,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/library/matrix/givmatdense.h b/src/library/matrix/givmatdense.h
index 886b9ca..9ac8480 100644
--- a/src/library/matrix/givmatdense.h
+++ b/src/library/matrix/givmatdense.h
@@ -22,7 +22,7 @@
 
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 // --
 // -- Matrix class: dense matrix
diff --git a/src/library/matrix/givmatdenseops.inl b/src/library/matrix/givmatdenseops.inl
index b4fedd5..ad3501a 100644
--- a/src/library/matrix/givmatdenseops.inl
+++ b/src/library/matrix/givmatdenseops.inl
@@ -12,7 +12,7 @@
 #error "this looks very much like dead code"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 template<class Domain>
 int MatrixDom<Domain,Dense>::areEqual ( const Rep& A, const Rep& B ) const
diff --git a/src/library/matrix/givmatrix.C b/src/library/matrix/givmatrix.C
index 249ae1e..4cbab32 100644
--- a/src/library/matrix/givmatrix.C
+++ b/src/library/matrix/givmatrix.C
@@ -1,5 +1,5 @@
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 } // Givaro
diff --git a/src/library/matrix/givmatrix.h b/src/library/matrix/givmatrix.h
index 9dedecb..52211a6 100644
--- a/src/library/matrix/givmatrix.h
+++ b/src/library/matrix/givmatrix.h
@@ -19,7 +19,7 @@
 #include "givaro/givelem.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 // ==========================================================================
diff --git a/src/library/matrix/givmatsparse.h b/src/library/matrix/givmatsparse.h
index 7a3613e..d74c6c4 100644
--- a/src/library/matrix/givmatsparse.h
+++ b/src/library/matrix/givmatsparse.h
@@ -21,7 +21,7 @@
 #include "givaro/givmatstoragesparse.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 // --
 // -- Matrix class: dense matrix
diff --git a/src/library/matrix/givmatsparseops.inl b/src/library/matrix/givmatsparseops.inl
index 52eb214..31180cb 100644
--- a/src/library/matrix/givmatsparseops.inl
+++ b/src/library/matrix/givmatsparseops.inl
@@ -12,7 +12,7 @@
 #error "this looks very much like dead code"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
   // -- map of a unary operator, with operator()( Type_t& res )
   // res and u could be aliases if OP permits it
diff --git a/src/library/matrix/givmatstorage.h b/src/library/matrix/givmatstorage.h
index 2d7ece5..5d4ad94 100644
--- a/src/library/matrix/givmatstorage.h
+++ b/src/library/matrix/givmatstorage.h
@@ -19,7 +19,7 @@
 #include "givaro/givcategory.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 // ==========================================================================
 // --
diff --git a/src/library/matrix/givmatstoragedense.h b/src/library/matrix/givmatstoragedense.h
index c7df04b..3cd2271 100644
--- a/src/library/matrix/givmatstoragedense.h
+++ b/src/library/matrix/givmatstoragedense.h
@@ -19,7 +19,7 @@
 #include "givaro/givmatstorage.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 // ==========================================================================
diff --git a/src/library/matrix/givmatstoragesparse.h b/src/library/matrix/givmatstoragesparse.h
index dec9e83..1866755 100644
--- a/src/library/matrix/givmatstoragesparse.h
+++ b/src/library/matrix/givmatstoragesparse.h
@@ -19,7 +19,7 @@
 #include "givaro/givmatstorage.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 // ==========================================================================
diff --git a/src/library/poly1/Makefile.in b/src/library/poly1/Makefile.in
index 90ac063..dee8f8d 100644
--- a/src/library/poly1/Makefile.in
+++ b/src/library/poly1/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivpoly1_la_LIBADD =
 am_libgivpoly1_la_OBJECTS = givindeter.lo givdegree.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivpoly1_la_SOURCES)
 DIST_SOURCES = $(libgivpoly1_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -260,9 +306,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/library/poly1/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/library/poly1/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/library/poly1/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/library/poly1/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -280,6 +326,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -289,7 +336,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivpoly1.la: $(libgivpoly1_la_OBJECTS) $(libgivpoly1_la_DEPENDENCIES) 
+libgivpoly1.la: $(libgivpoly1_la_OBJECTS) $(libgivpoly1_la_DEPENDENCIES) $(EXTRA_libgivpoly1_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivpoly1_la_OBJECTS) $(libgivpoly1_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -314,21 +361,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -342,7 +393,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -350,29 +401,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -393,13 +449,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -420,16 +480,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -519,6 +585,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/library/poly1/givdegree.h b/src/library/poly1/givdegree.h
index 063064b..7c7bfb3 100644
--- a/src/library/poly1/givdegree.h
+++ b/src/library/poly1/givdegree.h
@@ -7,17 +7,22 @@
 // see the COPYRIGHT file for more details.
 // Authors: T. Gautier
 // $Id: givdegree.h,v 1.7 2011-02-02 16:23:56 bboyer Exp $
-// Description: opaque class for Degree of polynomial. Degree of polynomial
-// 0 is Degree::deginfty with value DEGPOLYZERO.
 // ==========================================================================
+/** @file givdegree.h
+ * @ingroup poly1
+ * @brief NO DOC
+ * opaque class for Degree of polynomial. Degree of polynomial
+ * 0 is Degree::deginfty with value DEGPOLYZERO.
+ *
+ */
+
 #ifndef __GIVARO_poly1degree_H
 #define __GIVARO_poly1degree_H
 
 #include <iostream>
 
 namespace Givaro {
-// -- Degree type for polynomials
-//
+//! Degree type for polynomials
 class Degree {
 public:
   typedef long value_type;
@@ -78,6 +83,7 @@ public:
   long _deg;
 };
 
+//! value
 inline long value(const Degree& d) { return d._deg; }
 } // Givaro
 
diff --git a/src/library/poly1/givindeter.h b/src/library/poly1/givindeter.h
index e915353..86156b9 100644
--- a/src/library/poly1/givindeter.h
+++ b/src/library/poly1/givindeter.h
@@ -8,8 +8,10 @@
 // Authors: T. Gautier
 // $Id: givindeter.h,v 1.6 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// - indeterminates for polynomial manipulation
+/** @file givindeter.h
+ * @ingroup poly1
+ * @brief indeterminates for polynomial manipulation
+ */
 #ifndef __GIVARO_indeter_H
 #define __GIVARO_indeter_H
 
@@ -18,6 +20,7 @@
 
 namespace Givaro {
 
+	//! Indeterminate
 class Indeter {
 public :
 
@@ -49,7 +52,8 @@ protected:
   std::string name;
 };
 
-  // Inline members functions :
+
+  //! @bug put elsewere. Inline members functions :
 inline int operator==(const Indeter& i1, const Indeter &i2)
   { return i1.compare(i2) ==0; }
 
diff --git a/src/library/poly1/givinterp.h b/src/library/poly1/givinterp.h
index 4423a44..ca9b11d 100644
--- a/src/library/poly1/givinterp.h
+++ b/src/library/poly1/givinterp.h
@@ -8,7 +8,12 @@
 // Authors: JG Dumas
 // $Id: givinterp.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
+
+/** @file givinterp.h
+ * @ingroup poly1
+ * @brief NO DOC
+ */
+
 #ifndef __GIVARO_interpolation_H
 #define __GIVARO_interpolation_H
 
@@ -18,6 +23,7 @@
 
 namespace Givaro {
 
+	//! Interpolation
 template<class Domain, bool REDUCE = true>
 struct Interpolation : Poly1Dom<Domain,Dense>  {
     typedef std::vector< typename Domain::Element > Vect_t;
diff --git a/src/library/poly1/givinterpgeom-multip.h b/src/library/poly1/givinterpgeom-multip.h
index 9a6356b..dc9c384 100644
--- a/src/library/poly1/givinterpgeom-multip.h
+++ b/src/library/poly1/givinterpgeom-multip.h
@@ -8,10 +8,13 @@
 // Authors: JG Dumas
 // $Id: givinterp.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// Interpolation at geometric points
-// see: Polynomial evaluation and interpolation on special sets of points,
-// A. Bostan and E. Schost, Journal of Complexity 21(4): 420-446, 2005.
+/** @file givinterpgeom-multip.h
+ * @ingroup poly1
+ * @brief Interpolation at geometric points
+ * @bib
+ * - A Bostan and E Schost, <i>Polynomial evaluation and interpolation on special sets of points</i>,
+ * Journal of Complexity 21(4): 420-446, 2005.
+ */
 
 #ifndef __GIVARO_multiple_interpolation_at_geometric_points_H
 #define __GIVARO_multiple_interpolation_at_geometric_points_H
@@ -23,6 +26,8 @@
 #include <vector>
 
 namespace Givaro {
+
+	//! Newton (multip)
 template<class Domain, bool REDUCE = true>
 struct NewtonInterpGeomMultip : TruncDom<Domain>  {
     typedef std::vector< typename Domain::Element > Vect_t;
diff --git a/src/library/poly1/givinterpgeom.h b/src/library/poly1/givinterpgeom.h
index aad7fd7..f62c6f9 100644
--- a/src/library/poly1/givinterpgeom.h
+++ b/src/library/poly1/givinterpgeom.h
@@ -8,10 +8,14 @@
 // Authors: JG Dumas
 // $Id: givinterp.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
-// Interpolation at geometric points
-// see: Polynomial evaluation and interpolation on special sets of points,
-// A. Bostan and E. Schost, Journal of Complexity 21(4): 420-446, 2005.
+
+/** @file givinterpgeom.h
+ * @ingroup poly1
+ * @brief  Interpolation at geometric points
+ * @bib
+ * - A Bostan and E Schost, <i> Polynomial evaluation and interpolation on special sets of points</i>,
+ *  Journal of Complexity 21(4): 420-446, 2005.
+ */
 
 #ifndef __GIVARO_interpolation_at_geometric_points_H
 #define __GIVARO_interpolation_at_geometric_points_H
@@ -22,6 +26,8 @@
 #include <givaro/givtruncdomain.h>
 
 namespace Givaro {
+
+	//! Newton
 template<class Domain, bool REDUCE = true>
 struct NewtonInterpGeom : TruncDom<Domain>  {
     typedef std::vector< typename Domain::Element > Vect_t;
diff --git a/src/library/poly1/givpoly1.h b/src/library/poly1/givpoly1.h
index 2c4a5d7..4fae199 100644
--- a/src/library/poly1/givpoly1.h
+++ b/src/library/poly1/givpoly1.h
@@ -8,7 +8,10 @@
 // Authors: T. Gautier
 // $Id: givpoly1.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description:
+/** @file givpoly1.h
+ * @ingroup poly1
+ * @brief NO DOC
+ */
 #ifndef __GIVARO_poly1_H
 #define __GIVARO_poly1_H
 
diff --git a/src/library/poly1/givpoly1addsub.inl b/src/library/poly1/givpoly1addsub.inl
index 45975c4..4294135 100644
--- a/src/library/poly1/givpoly1addsub.inl
+++ b/src/library/poly1/givpoly1addsub.inl
@@ -102,24 +102,74 @@ return R;
 }
 
 template <class Domain>
-inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin (Rep& R, const Rep& P) const
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::addin
+ (Rep& R, const Type_t& Val) const
 {
-  size_t sP = P.size();
   size_t sR = R.size();
+  if (sR == 0)  {
+      R.reallocate(1);
+      _domain.assign(R[0],Val);
+  } else
+      _domain.addin(R[0],Val);
+  return R;
+}
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin (
+    Rep& R, const typename Rep::iterator Rbeg,
+    const Rep& P, const typename Rep::const_iterator Pbeg, const typename Rep::const_iterator Pend) const
+{
+    // PRECONDITION: NO reallocation, R MUST be of larger degree than P
+    typename Rep::iterator ri=Rbeg;
+    typename Rep::const_iterator pi=Pbeg;
+    for( ; pi != Pend; ++pi, ++ri) _domain.subin(*ri,*pi);
+    return R;
+}
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin (
+    Rep& R,
+    const Rep& P, const typename Rep::const_iterator Pbeg, const typename Rep::const_iterator Pend) const
+{
+    // PRECONDITION: P of larger degree than R
+    size_t sP = (size_t)(Pend-Pbeg);
+    size_t sR = R.size();
+    Rep tmp; tmp.reallocate(sP);
+    size_t i;
+    typename Rep::const_iterator pi=Pbeg;
+    for (i=0; i<sR; ++i, ++pi) _domain.sub(tmp[i], R[i], *pi);
+    for (; pi != Pend; ++i, ++pi) _domain.neg(tmp[i], *pi);
+    setdegree(tmp);
+    R.copy(tmp);
+    return R;
+}
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin (
+    Rep& R, const typename Rep::iterator Rbeg, const typename Rep::iterator Rend,
+    const Rep& P, const typename Rep::const_iterator Pbeg, const typename Rep::const_iterator Pend) const{
+  size_t sP = (size_t) (Pend-Pbeg);
+  size_t sR = (size_t)(Rend-Rbeg);
   if (sP == 0) return R;
-  if (sR == 0) { return neg(R,P); }
-//   if (sR == sP){ _supportdomain.subin(R,P); return; }
   if (sR < sP) {
-    size_t i;
-    Rep tmp; tmp.reallocate(sP);
-    for (i=0; i<sR; ++i) _domain.sub(tmp[i], R[i], P[i]);
-    for (; i<sP; ++i) _domain.neg(tmp[i], P[i]);
-    R.logcopy(tmp);
+      return subin(R, P, Pbeg, Pend);
   }
   else {
-    for (size_t i=0; i<sP; ++i) _domain.subin(R[i], P[i]);
+      return subin(R, Rbeg, P, Pbeg, Pend);
   }
-return R;
+}
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin (Rep& R, const Rep& P) const
+{
+  size_t sP = P.size();
+  size_t sR = R.size();
+  if (sP == 0) return R;
+  if (sR == 0) { return neg(R,P); }
+  if (sR < sP)
+      return setdegree( subin(R, P, P.begin(), P.end()) );
+  else
+      return setdegree( subin(R, R.begin(), P, P.begin(), P.end()) );
 }
 
 template <class Domain>
@@ -166,6 +216,19 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::sub
 }
 
 template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::subin
+ (Rep& R, const Type_t& Val) const
+{
+  size_t sR = R.size();
+  if (sR == 0)  {
+      R.reallocate(1);
+      _domain.neg(R[0],Val);
+  } else
+      _domain.subin(R[0],Val);
+  return R;
+}
+
+template <class Domain>
 inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::sub
  (Rep& R, const Type_t& Val, const Rep& P) const
 {
diff --git a/src/library/poly1/givpoly1crt.h b/src/library/poly1/givpoly1crt.h
index e720c25..73e607b 100644
--- a/src/library/poly1/givpoly1crt.h
+++ b/src/library/poly1/givpoly1crt.h
@@ -6,8 +6,13 @@
 // see the COPYRIGHT file for more details.
 // Authors: J-G Dumas
 // Time-stamp: <06 May 10 13:47:28 Jean-Guillaume.Dumas at imag.fr>
-// Description: Polynomial Chinese Remaindering of degree 1
 // ==========================================================================
+
+/** @file givpoly1crt.h
+ * @ingroup poly1
+ * @brief Polynomial Chinese Remaindering of degree 1
+ */
+
 #ifndef __GIVARO_poly1_crt_H
 #define __GIVARO_poly1_crt_H
 #include <givaro/givpoly1.h>
@@ -15,6 +20,8 @@
 #include <vector>
 
 namespace Givaro {
+
+	//! Poly1 CRT
 template<class Field>
 class Poly1CRT  {
     typedef Poly1CRT<Field> 			Self_t;
diff --git a/src/library/poly1/givpoly1crtcstor.inl b/src/library/poly1/givpoly1crtcstor.inl
index cc631af..5d73b5c 100644
--- a/src/library/poly1/givpoly1crtcstor.inl
+++ b/src/library/poly1/givpoly1crtcstor.inl
@@ -23,7 +23,7 @@ Poly1CRT<Field>::Poly1CRT ()
 {}
 
 template<class Field>
-Poly1CRT<Field>::Poly1CRT (const Poly1CRT<Field>& R)
+Poly1CRT<Field>::Poly1CRT (const Self_t& R)
  : _XIndet(R._XIndet),
    _F(R._F),
    _PolRing(R._PolRing),
@@ -34,7 +34,7 @@ Poly1CRT<Field>::Poly1CRT (const Poly1CRT<Field>& R)
 
   // -- Array of primes are given
 template<class Field>
-Poly1CRT<Field>::Poly1CRT( const Field& F, const Poly1CRT<Field>::array_T& inprimes, const Indeter& X)
+Poly1CRT<Field>::Poly1CRT( const Field& F, const array_T& inprimes, const Indeter& X)
  : _XIndet(X),
    _F(F),
    _PolRing(F,X),
diff --git a/src/library/poly1/givpoly1cstor.inl b/src/library/poly1/givpoly1cstor.inl
index 16e79f2..0fe2870 100644
--- a/src/library/poly1/givpoly1cstor.inl
+++ b/src/library/poly1/givpoly1cstor.inl
@@ -13,13 +13,16 @@
 
 namespace Givaro {
 	template<class Domain>
-	inline Poly1Dom<Domain,Dense>::Poly1Dom(const Domain& d, const Indeter& X )
-	: _domain(d), _x(X) ,zero(1,d.zero), one(1,d.one)
+	inline Poly1Dom<Domain,Dense>::Poly1Dom(const Domain& d, const Indeter& X ) :
+		_domain(d), _x(X)
+		, zero(1,d.zero), one(1,d.one)
+		, mOne(1,d.mOne)
 	{}
 
 	template<class Domain>
-	inline Poly1Dom<Domain,Dense>::Poly1Dom(const Self_t& P)
-	: _domain(P._domain), _x(P._x) ,zero(P.zero), one(P.one)
+	inline Poly1Dom<Domain,Dense>::Poly1Dom(const Self_t& P) :
+		_domain(P._domain), _x(P._x)
+		,zero(P.zero), one(P.one),mOne(P.mOne)
 	{}
 
 	template<class Domain>
@@ -58,8 +61,9 @@ namespace Givaro {
 			P.reallocate(0);
 			return P;
 		}
-		P.reallocate(++degQ);
-		for (int i=0; degQ>i; ++i)
+		P.reallocate((size_t)++degQ);
+		// degQ >=0
+		for (size_t i=0; (size_t)degQ.value()>i; ++i)
 			_domain.assign(P[i], Q[i]);
 		return P;
 	}
@@ -108,7 +112,7 @@ namespace Givaro {
 	template<class Domain>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::init( Rep& P, const Degree deg ) const
 	{
-		P.reallocate(value(deg+1));
+		P.reallocate((size_t)value(deg+1));
 
 		size_t sz = P.size();
 		for (unsigned int i=0; i<sz-1; ++i)
@@ -122,12 +126,13 @@ namespace Givaro {
 	( Rep& P, const Degree d, const XXX& Val ) const
 	{
 		long deg = value(d);
-		P.reallocate(deg+1);
-		for (int i=0; i<deg; ++i)
-			_domain.assign(P[i], _domain.zero);
-		_domain.init(P[deg], Val);
+		P.reallocate((size_t)deg+1);
+		assert (deg>=0);
+			for (size_t i=0; i<(size_t)deg; ++i)
+				_domain.assign(P[i], _domain.zero);
+		_domain.init(P[(size_t)deg], Val);
 
-		if (_domain.isZero(P[deg])) {
+		if (_domain.isZero(P[(size_t)deg])) {
 			P.reallocate(0);
 		}
 		return P;
@@ -141,11 +146,13 @@ namespace Givaro {
 		long deg = value(d);
 		if (_domain.isZero(lcoeff)) {
 			P.reallocate(0);
-		} else {
-			P.reallocate(deg+1);
-			for (int i=0; i<deg; ++i)
+		}
+	       	else {
+			P.reallocate((size_t)deg+1);
+			assert (deg>=0);
+			for (size_t i=0; i<(size_t)deg; ++i)
 				_domain.assign(P[i], _domain.zero);
-			_domain.assign(P[deg], lcoeff);
+			_domain.assign(P[(size_t)deg], lcoeff);
 		}
 		return P;
 	}
diff --git a/src/library/poly1/givpoly1cyclo.inl b/src/library/poly1/givpoly1cyclo.inl
index e665701..fc6bd67 100644
--- a/src/library/poly1/givpoly1cyclo.inl
+++ b/src/library/poly1/givpoly1cyclo.inl
@@ -49,7 +49,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::cyclotomic(
         return setdegree(P);
     } else if (IF.isprime(n)) {
         init(P, Degree(n-1));
-        for(size_t i=n-1;i--;)
+        for(size_t i=(size_t)n-1;--i;)
             _domain.assign(P[i], _domain.one);
         return setdegree(P);
     }
diff --git a/src/library/poly1/givpoly1dense.h b/src/library/poly1/givpoly1dense.h
index aa0aef9..8ffb0fe 100644
--- a/src/library/poly1/givpoly1dense.h
+++ b/src/library/poly1/givpoly1dense.h
@@ -8,8 +8,11 @@
 // Authors: T. Gautier
 // $Id: givpoly1dense.h,v 1.29 2011-02-02 16:23:56 bboyer Exp $
 // ==========================================================================
-// Description: univariate polynomial over T
-// - we assume that T is a ring (0,1,+,*)
+/** @file givpoly1dense.h
+ * @ingroup poly1
+ * @brief univariate polynomial over T.
+ * we assume that T is a ring (0,1,+,*)
+ */
 #ifndef __GIVARO_poly1_dense_H
 #define __GIVARO_poly1_dense_H
 
@@ -26,6 +29,7 @@
 
 namespace Givaro {
 
+	//! givvector
 	template < typename T, typename A=std::allocator<T> >
 	class givvector : public __GIV_STANDARD_VECTOR<T,A> {
 		typedef givvector<T,A>     Self_t;
@@ -92,9 +96,17 @@ namespace Givaro {
 		}
 
 
+		//! @warning we have no field in Vectors so << is RAW.
+            friend std::ostream& operator<<(std::ostream& out, const Self_t& V) {
+                out << '[';
+                for(typename Self_t::const_iterator it=V.begin(); it!= V.end(); ++it)
+		    out << *it << ' ';
+                return out << ']';
+            }
+
 	};
 
-	//  -------------------------------------------- Class Poly1Dom<Domain>
+	//!  Class Poly1Dom
 	template <class Domain>
 	class Poly1Dom<Domain,Dense> {
 	protected:  //  -- Representation
@@ -126,7 +138,7 @@ namespace Givaro {
 		Poly1Dom (const Self_t&);
 		Type_t characteristic() const
 		{
-			return _domain.characteristic();
+			return (Type_t)_domain.characteristic();
 		}
 		Integer& characteristic( Integer& p) const
 		{
@@ -161,15 +173,32 @@ namespace Givaro {
 		{
 			return _domain;
 		}
+
 		Domain& setdomain(const Domain& D)
 		{
 			return _domain = D;
 		}
 
+		// -- Return the domain of the entries
+		const Domain& subDomain() const
+		{
+			return _domain;
+		}
+		// -- Return the domain of the entries
+		const Domain& getDomain() const
+		{
+			return _domain;
+		}
+
+		Domain& setDomain(const Domain& D)
+		{
+			return _domain = D;
+		}
 
 		// -- Constantes
 		Rep zero;
 		Rep one;
+		Rep mOne;
 
 		// -- Init polynomial
 		Rep& init(Rep& a) const;
@@ -225,9 +254,11 @@ namespace Givaro {
 
 		// -- Returns the i-th coefficients
 		Type_t& getEntry(Type_t& c, const Degree& i, const Rep& P) const;
+		Type_t  setEntry(Rep &P, const Type_t&c, const Degree&i) const;
 
 		// -- Returns the degree of polynomial
 		Degree& degree(Degree& d, const Rep& P) const;
+		Degree degree(const Rep& P) const;
 
 		// -- Returns the valuation of polynomial
 		Degree& val(Degree& d, const Rep& P) const;
@@ -238,6 +269,7 @@ namespace Givaro {
 		 * @param P polynomial
 		 */
 		Rep& setdegree( Rep& P ) const;
+		Rep& setDegree( Rep& P ) const { return setdegree(P); }
 
 		// -- Evaluation on one point.
 		Type_t& eval(Type_t& pval, const Rep& P, const Type_t& val) const;
@@ -258,11 +290,13 @@ namespace Givaro {
 
 		// -- Arithmetics operators
 		Rep& addin ( Rep& res, const Rep& u ) const;
+		Rep& addin ( Rep& res, const Type_t& val ) const;
 		Rep& add ( Rep& res, const Rep& u, const Rep& v ) const;
 		Rep& add ( Rep& res, const Rep& u, const Type_t& val ) const;
 		Rep& add ( Rep& res, const Type_t& val, const Rep& v ) const;
 
 		Rep& subin ( Rep& res, const Rep& u ) const;
+		Rep& subin ( Rep& res, const Type_t& val ) const;
 		Rep& sub ( Rep& res, const Rep& u, const Rep& v ) const;
 		Rep& sub ( Rep& res, const Rep& u, const Type_t& val ) const;
 		Rep& sub ( Rep& res, const Type_t& val, const Rep& v ) const;
@@ -272,13 +306,21 @@ namespace Givaro {
 
 		Rep& mulin ( Rep& q, const Rep& a ) const;
 		Rep& mulin ( Rep& q, const Type_t& a ) const;
-		Rep& mul   ( Rep& q, const Rep& a, const Rep& b ) const;
 		Rep& mul   ( Rep& q, const Type_t& a, const Rep& b ) const;
 		Rep& mul   ( Rep& q, const Rep& a, const Type_t& b ) const;
-
+            // generic mul with dynamic recursive choices between stdmul and karamul
+        Rep& mul   ( Rep& q, const Rep& a, const Rep& b ) const;
+            // Forces standard multiplication algorithm
+        Rep& stdmul( Rep& R, const Rep& P, const Rep& Q) const;
+            // Forces first level of Karatsuba multiplication algorithm
+        Rep& karamul( Rep& R, const Rep& P, const Rep& Q) const;
+        
 		// Compute truncated mul: only the coefficients inside
 		// the degree interval, included
 		Rep& mul( Rep&, const Rep&, const Rep&, const Degree&, const Degree&) const;
+        
+        
+		Rep& sqr   ( Rep& q, const Rep& a ) const;
 
 
 		Rep& shiftin ( Rep&, int ) const;
@@ -381,9 +423,57 @@ namespace Givaro {
 		template< class RandIter > Rep& nonzerorandom(RandIter& g, Rep& r, const Rep& b) const;
 
 		// -- Square free decomposition
+		/** Sqrfree decomposition.
+		 * Decompose P such that:
+		 * P = Fact[0]^0 * Fact[1]^1 * ... * Fact[P.degree()]^(P.degree()),
+		 * with Fact[0] the leading coefficient.
+		 * The array Fact must be allocated before calling the function.
+		 * The size of Fact must be degP+1 is all factors should be computed.
+		 * For more readeable version of the algorithm, see Geddes, p342.
+		 * @param Nfact [in] the size of Fact
+		 * @param Fact  [in] an array of dimension Nfact
+		 @param Nfact [out] is the number of factor in the sqrfree decomposition
+		 @param Fact  [out] contains at most Nfact factors of the decomposition.
+		 @param P rep.
+		  */
+
 		size_t& sqrfree(size_t& Nfact, Rep* Fact, const Rep& P) const;
 
 
+        protected:
+            typedef typename Rep::iterator RepIterator;
+            typedef typename Rep::const_iterator RepConstIterator;
+
+                // Mul only between iterator intervals
+            Rep& mul( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                      const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+                      const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const;
+
+            Rep& stdmul( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                      const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+                      const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const;
+            Rep& karamul( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                      const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+                      const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const;
+
+            Rep& sqr( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                      const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend) const;
+            Rep& stdsqr( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                         const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+                         const Type_t& two) const;
+            Rep& sqrrec( Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                         const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+                         const Type_t& two) const;
+
+                // Sub only between iterator intervals
+            Rep& subin (Rep& R,
+                        const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend) const;
+
+            Rep& subin (Rep& R, const RepIterator Rbeg,
+                        const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend) const;
+            Rep& subin (Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+                        const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend) const;
+
 	}; //  ------------------------------- End Of The Class Poly1Dom<Type_t>
 
 } // Givaro
diff --git a/src/library/poly1/givpoly1denseops.inl b/src/library/poly1/givpoly1denseops.inl
index aa73429..b1ce220 100644
--- a/src/library/poly1/givpoly1denseops.inl
+++ b/src/library/poly1/givpoly1denseops.inl
@@ -11,6 +11,7 @@
 #include "givaro/givpoly1misc.inl"
 #include "givaro/givpoly1addsub.inl"
 #include "givaro/givpoly1muldiv.inl"
+#include "givaro/givpoly1kara.inl"
 #include "givaro/givpoly1axpy.inl"
 #include "givaro/givpoly1io.inl"
 #include "givaro/givpoly1gcd.inl"
diff --git a/src/library/poly1/givpoly1factor.h b/src/library/poly1/givpoly1factor.h
index d379578..89bd3ac 100644
--- a/src/library/poly1/givpoly1factor.h
+++ b/src/library/poly1/givpoly1factor.h
@@ -4,13 +4,21 @@
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Irreducibily test
-// Factorisations de  Polynomes dans Fp[X] :
-//      Distinct Degree
-//      Cantor-Zassenhaus
-//      Berlekamp: moved in LinBox
 // Time-stamp: <27 Jun 05 11:35:32 Jean-Guillaume.Dumas at imag.fr>
 // ================================================================= //
+
+/** @file givpoly1factor.h
+ * @ingroup poly1
+ * @brief NO DOC
+ * - Irreducibily test
+ * - Factorisations de  Polynomes dans Fp[X] :
+ * - Distinct Degree
+ * - Cantor-Zassenhaus
+ * - Berlekamp: moved in LinBox
+ * .
+ */
+
+
 #ifndef __GIVARO_poly1_facto_H
 #define __GIVARO_poly1_facto_H
 #include <givaro/givrandom.h>
@@ -21,6 +29,7 @@ namespace Givaro {
 
 	// template<class Domain, class StorageTag> class Poly1FactorDom {};
 
+	//! Poly1FactorDom
 	template<class Domain, class Tag, class RandIter = GivRandom>
 	class Poly1FactorDom : public Poly1Dom<Domain,Tag> {
 	protected:
@@ -33,6 +42,7 @@ namespace Givaro {
 		typedef typename Poly1Dom<Domain,Tag>::Element                          Element;
 		typedef          RandIter                                      random_generator;
 		typedef typename Signed_Trait<typename Domain::Element>::unsigned_type Residu_t;
+		typedef typename Signed_Trait<typename Domain::Element>::signed_type   Element_t;
 		// typedef typename Domain::Residu_t                                      Residu_t;
 
 		Poly1FactorDom () {}
diff --git a/src/library/poly1/givpoly1factor.inl b/src/library/poly1/givpoly1factor.inl
index 667e2de..87217e0 100644
--- a/src/library/poly1/givpoly1factor.inl
+++ b/src/library/poly1/givpoly1factor.inl
@@ -15,6 +15,7 @@
 #ifndef __GIVARO_poly1_facto_INL
 #define __GIVARO_poly1_facto_INL
 #include <givaro/givpower.h>
+#include <givaro/givcaster.h>
 
 //!@todo use NTL if available ?
 
@@ -33,44 +34,43 @@ inline void Poly1FactorDom<Domain,Tag, RandIter>::SplitFactor(
     , Degree d
     , Residu_t MOD) const
 {
-    Degree dG;degree(dG,G);
+    Degree dG; this->degree(dG,G);
     if (dG == d)
         L.push_back(G);
     else {
         int splitted = 0;
         while (! splitted) {
-            Rep tmp, G1;
-            this->gcd(G1, G, this->random(_g, tmp, dG-1));
-            Degree dG1; degree(dG1,G1);
-// write(std::cerr << "SF rd: ", tmp) << std::endl;
+            Rep G1, G2;
+            this->gcd(G1, G, this->random(_g, G2, dG-1) );
+            Degree dG1; this->degree(dG1,G1);
+// write(std::cerr << "SF rd: ", G2) << std::endl;
 // write(std::cerr << "SF G1: ", G1) << std::endl;
             if ( dG1 != dG) {
                 if (dG1 > 0 ) {
                     splitted = 1;
                     SplitFactor ( L, G1, d, MOD) ;
+                    this->div(G2, G, G1);
+                    SplitFactor ( L, G2, d, MOD) ;
+                    return ;
                 }
 
-                Integer pp = (power(Integer(MOD), d.value()) - 1)/2;
+                Integer iMOD; Caster(iMOD, MOD);
+                Integer pp = (power(iMOD, d.value()) - 1)/2;
 // std::cerr << "pp: " << pp << std::endl;
-                Rep tp, tp2, G2;
-                this->gcd(G2,G, sub(tp2, this->powmod(tp, tmp, pp, G) , _domain.one) );
-                Degree dG2; degree(dG2,G2);
+                Rep tp;
+                this->gcd(G1, G,
+                          this->subin( this->powmod(tp, G2, pp, G), 
+                                       _domain.one) 
+                          );
+
+                this->degree(dG1,G1);
 // write(std::cerr << "SF t2: ", tp2) << std::endl;
-// write(std::cerr << "SF G2: ", G2) << std::endl;
-                if ( dG2 != dG) {
-                    if ( dG2 > 0 ) {
-                        splitted = 1 ;
-                        SplitFactor ( L, G2, d, MOD) ;
-                    }
-// UNNECESSARY : ANYTHING FOUND BY G3 WOULD HAVE THE COFACTOR IN G2
-                     Rep G3; this->gcd(G3, G, add(tp2,tp,_domain.one) );
-                     Degree dG3; degree(dG3,G3);
-// write(std::cerr << "SF t3: ", tp2) << std::endl;
-// write(std::cerr << "SF G3: ", G3) << std::endl;
-                     if (( dG3 != dG) && (dG3 > 0 )) {
-                         splitted = 1 ;
-                         SplitFactor ( L, G3, d, MOD) ;
-                     }
+// write(std::cerr << "SF G1: ", G1) << std::endl;
+                if ( ( dG1 != dG) && (dG1 > 0 ) ) {
+                    splitted = 1 ;
+                    SplitFactor ( L, G1, d, MOD) ;
+                    this->div( G2, G, G1);
+                    SplitFactor ( L, G2, d, MOD) ;
                 }
             }
         }
@@ -84,7 +84,7 @@ inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain
     , const Rep& G
     , Degree d
     , Residu_t MOD)  const  {
-    Degree dG;degree(dG,G);
+    Degree dG;this->degree(dG,G);
     if (dG == d)
         return G1.copy(G) ;
     else {
@@ -93,15 +93,16 @@ inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain
             this->gcd(G1, G, this->random(_g, tmp, d));
 // write(std::cerr << "SF rd: ", tmp) << std::endl;
 // write(std::cerr << "SF G1: ", G1) << std::endl;
-            Degree dG1; degree(dG1,G1);
+            Degree dG1; this->degree(dG1,G1);
             if ( dG1 != dG) {
                 if (dG1 > 0 ) {
                     return G1;
                 }
-                Integer pp = (power(Integer(MOD), d.value()) - 1)/2;
+                Integer iMOD; Caster(iMOD, MOD);
+                Integer pp = (power(iMOD, d.value()) - 1)/2;
                 Rep tp, tp2, G2;
-                this->gcd(G2,G, sub(tp2, this->powmod(tp, tmp, pp, G) , _domain.one) );
-                Degree dG2; degree(dG2,G2);
+                this->gcd(G2,G, this->sub(tp2, this->powmod(tp, tmp, pp, G) , _domain.one) );
+                Degree dG2; this->degree(dG2,G2);
 // write(std::cerr << "SF t2: ", tp2) << std::endl;
 // write(std::cerr << "SF G2: ", G2) << std::endl;
                 if ( dG2 != dG) {
@@ -109,8 +110,8 @@ inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain
                         return G1.copy(G2);
                     }
 // UNNECESSARY : ANYTHING FOUND BY G3 WOULD HAVE THE COFACTOR IN G2
-                     Rep G3; this->gcd(G3, G, add(tp2,tp,_domain.one) );
-                     Degree dG3; degree(dG3,G3);
+                     Rep G3; this->gcd(G3, G, this->add(tp2,tp,_domain.one) );
+                     Degree dG3; this->degree(dG3,G3);
 // write(std::cerr << "SF t3: ", tp2) << std::endl;
 // write(std::cerr << "SF G3: ", G3) << std::endl;
                      if (( dG3 != dG) && (dG3 > 0 )) {
@@ -138,21 +139,22 @@ inline void Poly1FactorDom<Domain,Tag, RandIter>::DistinctDegreeFactor(
 // write(std::cerr << "DD in: ", f) << std::endl;
     Rep W, D, P = f;
     Degree dP;
-    Rep Unit, G1; init(Unit, Degree(1));
+    Rep Unit, G1;
+    this->init(Unit, Degree(1));
     W.copy(Unit);
-    degree(dP,P); Degree dPo = (dP/2);
+    this->degree(dP,P); Degree dPo = (dP/2);
     for(Degree dp = 1; dp <= dPo; ++dp) {
 // std::cerr << "DD degree: " << dp << std::endl;
         this->powmod(W, D.copy(W), MOD, P);
-        this->gcd (G1,sub(D,W,Unit), P) ;
-        Degree dG1; degree(dG1,G1);
+        this->gcd (G1,this->sub(D,W,Unit), P) ;
+        Degree dG1; this->degree(dG1,G1);
 // write(std::cerr << "DD found: ", G1) << ", of degree " << dG1 << std::endl;
         if ( dG1 > 0 ) {
             SplitFactor (L, G1, dp, MOD);
-            divin(P,G1);
+            this->divin(P,G1);
         }
     }
-    degree(dP,P);
+    this->degree(dP,P);
     if (dP > 0)
         L.push_back(P);
 // write(std::cerr << "DD: ", P) << std::endl;
@@ -171,10 +173,11 @@ Poly1FactorDom<Domain,Tag, RandIter>::CZfactor( Container< Rep, Alloc<Rep> > & L
 	       Residu_t MOD)  const
 {
 // write(std::cerr << "CZ in: ", P) << std::endl;
-    Degree dp; degree(dp,P);
-    size_t nb=dp.value()+1;
+    Degree dp;
+    this->degree(dp,P);
+    size_t nb=(size_t)dp.value()+1;
     Rep * g = new Rep[nb];
-    sqrfree(nb,g,P);
+    this->sqrfree(nb,g,P);
 // std::cerr << "CZ sqrfree: " << nb << std::endl;
     for(size_t i = 0; i<nb;++i) {
         size_t this_multiplicity = Lf.size();
@@ -202,17 +205,18 @@ inline bool Poly1FactorDom<Domain,Tag, RandIter>::is_irreducible( const Rep& P
 								  , Residu_t MOD ) const
 {
 	Rep W,D;
-	this->gcd(W,diff(D,P),P);
+	this->gcd(W,this->diff(D,P),P);
 	Degree d, dP;
-	if (degree(d,W) > 0) return 0;
+	if (this->degree(d,W) > 0) return 0;
 	// Distinct degree free ?
-	Rep Unit, G1; init(Unit, Degree(1));
+	Rep Unit, G1;
+	this->init(Unit, Degree(1));
 	W.copy(Unit);
-	degree(dP,P); Degree dPo = (dP/2);
+	this->degree(dP,P); Degree dPo = (dP/2);
 	for(Degree dp = 1; dp <= dPo; ++dp) {
 		this->powmod(W, D.copy(W), MOD, P);
-		this->gcd (G1, sub(D,W,Unit), P) ;
-		if ( degree(d,G1) > 0 ) return 0;
+		this->gcd (G1, this->sub(D,W,Unit), P) ;
+		if ( this->degree(d,G1) > 0 ) return 0;
 	}
 	return 1;
 }
@@ -236,17 +240,17 @@ inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain
 // write(cerr << "In factor P':", D) << "(deg: " << degree(d,D) << ")" << endl;
 // write(cerr << "In factor P^P':", W) << "(deg: " << degree(d,W) << ")" << endl;
 
-    if (degree(d,W) > 0) return W;
+    if (this->degree(d,W) > 0) return W;
         // Distinct degree free ?
     Rep Unit, G1; init(Unit, Degree(1));
 // write(cerr << "In factor U:", Unit) << endl;
     W.copy(Unit);
-    degree(dP,P); Degree dPo = (dP/2);
+    this->degree(dP,P); Degree dPo = (dP/2);
     for(Degree dp = 1; dp <= dPo; ++dp) {
 // write(cerr << "In factor W:(deg: " << degree(d,W) << "):", W) << endl;
         this->powmod(W, D.copy(W), MOD, P);
         this->gcd (G1, sub(D,W,Unit), P) ;
-        Degree dG1; degree(dG1,G1);
+        Degree dG1; this->degree(dG1,G1);
         if ( dG1 > 0 ) {
             if (dG1 < dP)
                 return W.copy(G1);
diff --git a/src/library/poly1/givpoly1io.inl b/src/library/poly1/givpoly1io.inl
index fbfaaff..5c5a6c5 100644
--- a/src/library/poly1/givpoly1io.inl
+++ b/src/library/poly1/givpoly1io.inl
@@ -100,7 +100,7 @@ std::istream& Poly1Dom<Domain,Dense>::read ( std::istream& i, Rep& P) const
     init(P,Degree(deg));
 // JGD 18.09.2002
     for(;deg>=0;--deg)
-        _domain.read( i, P[deg]);
+        _domain.read( i, P[(size_t)deg]);
         // i >> P[deg];
     return i;
 }
diff --git a/src/library/poly1/givpoly1kara.inl b/src/library/poly1/givpoly1kara.inl
index 2a5bf69..0348bf5 100644
--- a/src/library/poly1/givpoly1kara.inl
+++ b/src/library/poly1/givpoly1kara.inl
@@ -1,173 +1,293 @@
 // ==========================================================================
 // $Source: /var/lib/cvs/Givaro/src/library/poly1/givpoly1kara.inl,v $
-// Copyright(c)'1994-2009 by The Givaro group
+// Copyright(c)'1994-2011 by The Givaro group
 // This file is part of Givaro.
 // Givaro is governed by the CeCILL-B license under French law
 // and abiding by the rules of distribution of free software.
 // see the COPYRIGHT file for more details.
-// Authors: T. Gautier
-// $Id: givpoly1kara.inl,v 1.3 2011-02-02 16:23:56 bboyer Exp $
+// Authors: J-G Dumas
+// $Id: givpoly1kara.inl,v 1.3 2011-11-08 10:38:00 jgdumas Exp $
 // ==========================================================================
-// Description: To be rewrite using Array0 and subarray0 or generator!!!
 #ifndef __GIVARO_poly1_kara_INL
 #define __GIVARO_poly1_kara_INL
 
-#define KARA_THRESHOLD 10
+namespace Givaro {
 
+#ifndef KARA_THRESHOLD
+#define KARA_THRESHOLD 50
+#endif
 
-namespace Givaro {
+#ifndef SQR_THRESHOLD
+#define SQR_THRESHOLD 50
+#endif
+
+#ifndef GIVMIN
+#define GIVMIN(a,b) ((a)<(b)?(a):(b))
+#endif
 
-template<class T>
-void Poly1<T>::stdmul(Array0<T>& R,
-                         const Array0<T>& P, const Array0<T>& Q,
-                         Degree tP, Degree tQ)
+// forces standard multiplication
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::stdmul( Rep& R, const Rep& P, const Rep& Q ) const
 {
-   int i,j ;
-   for (i=0 ; i <= tP+tQ ; i++) R[i] = T(zero) ;
-   for (i=0 ; i <= tP ; i++)
-     for (j=0 ; j <= tQ ; j++)
-           R[i+j] += P[i]*Q[j] ;
+	const size_t sR = R.size();
+	const size_t sP = P.size();
+	const size_t sQ = Q.size();
+	if ((sQ ==0) || (sP ==0)) { R.reallocate(0); return R; }
+	if (sR != sQ+sP) R.reallocate(sR = sP+sQ-1);
+
+ 	stdmul(R, R.begin(), R.end(),
+            P, P.begin(), P.end(),
+            Q, Q.begin(), Q.end());
+
+    return setdegree(R);
 }
 
-  // Tailles requises par les entrees.
-  // P  : polynome de degre tP
-  // Q  :   "       "       tQ
-  // R  :   "       "       tP+tQ
-  // Tmp1 : "       "       2*([1+max(tP,tQ)] div 2)
-  // Tmp2 : "       "       ([1+max(tP,tQ)] div 2)
-  // Au sein de l'algo :
-  // P0 :   "       "       k <= tP
-  // P1 :   "       "       tP - k <= k
-  // Q0 :   "       "       k <= tQ
-  // Q1 :   "       "       tQ - k <= k
-template<class T>
-void Poly1<T>::karatsuba(Array0<T>& P, const Array0<T>& Q,
-                Array0<T>& R, Array0<T>& Tmp1,
-                Degree tP, Degree tQ)
+// forces FIRST recursive level with Karatsuba multiplication
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::karamul( Rep& R, const Rep& P, const Rep& Q ) const
 {
-   if ((tP <=KARA_THRESHOLD) || (tQ <=KARA_THRESHOLD))
-    {
-      Poly1<T>::stdmul(P, Q, R, tP, tQ) ;
-      return ;
-    }
+	const size_t sR = R.size();
+	const size_t sP = P.size();
+	const size_t sQ = Q.size();
+	if ((sQ ==0) || (sP ==0)) { R.reallocate(0); return R; }
+	if (sR != sQ+sP) R.reallocate(sR = sP+sQ-1);
 
-   Degree k ;
-   if (tQ <= tP)
-    {
-       int i ;
-       k = tP/2 ;
-       if (tQ <= k)
-        {
-//cout << "heheh : tP:" << tP << " tQ: " << tQ << endl  ;
-          Poly1<T>::karatsuba(P, Q, R, Tmp1, k, tQ) ;
-          Poly1<T>::karatsuba(P+k+1, Q, Tmp1, P, tP-k-1, tQ) ;
-          for (i=0 ; i <= tP+tQ-k-1 ; i++) R[i+k+1] += Tmp1[i] ;
-          return ;
+ 	karamul(R, R.begin(), R.end(),
+            P, P.begin(), P.end(),
+            Q, Q.begin(), Q.end());
+
+    return setdegree(R);
+}
+
+// Generic mul with choices between standard and Karatsuba multiplication
+// Multiplies between the iterator bounds.
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul(
+    Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+    const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+    const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const {
+
+    if ( ( (Pend-Pbeg)> KARA_THRESHOLD ) &&
+         ( (Qend-Qbeg)> KARA_THRESHOLD) )
+        return karamul(R, Rbeg, Rend,
+                       P, Pbeg, Pend,
+                       Q, Qbeg, Qend);
+    else
+        return stdmul(R, Rbeg, Rend,
+                      P, Pbeg, Pend,
+                      Q, Qbeg, Qend);
+}
+
+
+// Generic sqr with choices between standard and recursive multiplication
+// Multiplies between the iterator bounds.
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::sqr(
+    Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+    const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend) const {
+
+    Type_t two; _domain.init(two);
+    _domain.add(two, _domain.one, _domain.one);    
+
+    if ( (Pend-Pbeg)> SQR_THRESHOLD )
+        return sqrrec(R, Rbeg, Rend,
+                      P, Pbeg, Pend, 
+                      two);
+    else
+        return stdsqr(R, Rbeg, Rend,
+                      P, Pbeg, Pend,
+                      two);
+}
+
+
+
+
+// Standard multiplication between iterator bounds
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::stdmul(
+    Rep& R, const RepIterator Rbeg, const RepIterator Rend,
+    const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+    const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const {
+
+	RepConstIterator ai=Pbeg,bi=Qbeg;
+	RepIterator ri=Rbeg, rig=Rbeg;
+	if (_domain.isZero(*ai))
+		for(;bi!=Qend;++bi,++ri)
+			*ri = _domain.zero;
+	else
+		for(;bi!=Qend;++bi,++ri)
+			if (_domain.isZero(*bi))
+				*ri = _domain.zero;
+			else
+				_domain.mul(*ri,*ai,*bi);
+
+	for(;ri!=Rend;++ri)
+		*ri = _domain.zero;
+	for(++ai,++rig;ai!=Pend;++ai,++rig)
+		if (! _domain.isZero(*ai))
+			for(ri=rig,bi=Qbeg;bi!=Qend;++bi,++ri)
+				_domain.axpyin(*ri,*ai,*bi);
+	return R;
+}
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::karamul( Rep& R, const RepIterator Rbeg, const RepIterator Rend, const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend, const Rep& Q, const RepConstIterator Qbeg, const RepConstIterator Qend ) const
+{
+    // Initialize R to zero
+    for(RepIterator ri=Rbeg; ri!= Rend; ++ri) _domain.assign(*ri,_domain.zero);
+
+
+    const size_t halfP = (size_t) ((Pend-Pbeg)>>1);
+    const size_t halfQ = (size_t) ((Qend-Qbeg)>>1);
+    const size_t half = GIVMIN(halfP, halfQ);
+    const size_t halfR = half<<1;
+
+    const RepConstIterator Pmid=Pbeg+(ssize_t)half;		// cut P in halves
+    const RepConstIterator Qmid=Qbeg+(ssize_t)half;		// cut Q in halves
+    const RepIterator Rmid=Rbeg+(ssize_t)halfR;			// cut R in halves
+
+    mul(R, Rbeg, Rmid, 				// Recursive dynamic choice
+        P, Pbeg, Pmid,
+        Q, Qbeg, Qmid);				// PlQl in first storage part of R
+
+    mul(R, Rmid, Rend,				// Recursive dynamic choice
+        P, Pmid, Pend,
+        Q, Qmid, Qend);				// PhQh in second storage part of R
+
+    Rep PHPL;
+    for(RepConstIterator PHi=Pmid; PHi!=Pend; ++PHi)
+        PHPL.push_back(*PHi);
+    subin(PHPL, PHPL.begin(), P, Pbeg, Pmid);	// Ph - Pl
+    setdegree(PHPL);
+
+    Rep QHQL;
+    for(RepConstIterator QHi=Qmid; QHi!=Qend; ++QHi)
+        QHQL.push_back(*QHi);
+    subin(QHQL, QHQL.begin(), Q, Qbeg, Qmid);	// Qh - Ql
+    setdegree(QHQL);
+
+    Rep M;
+    mul(M, 					// Recursive dynamic choice
+        PHPL,
+        QHQL);					// (Ph-Pl)(Qh-Ql)
+    setdegree(M);
+
+    subin(M, M.begin(), M.end(), R, Rbeg, Rmid);// -= PlQl
+    setdegree(M);
+
+    subin(M, M.begin(), M.end(), R, Rmid, Rend);// -= PhQh
+    setdegree(M);
+
+
+    RepIterator ri=Rbeg+(ssize_t)half;
+    RepConstIterator mi=M.begin();		// update R with mid product
+    for( ; mi != M.end(); ++ri, ++mi) _domain.subin(*ri, *mi);
+
+    return R;
+}
+
+
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::sqrrec( Rep& R, const RepIterator Rbeg, const RepIterator Rend, const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend, const Type_t& two) const
+{
+    // Initialize R to zero
+    for(RepIterator ri=Rbeg; ri!= Rend; ++ri) _domain.assign(*ri,_domain.zero);
+
+
+    const size_t half = (size_t) ((Pend-Pbeg)>>1);
+    const size_t halfR = (half<<1);
+
+    const RepConstIterator Pmid=Pbeg+(ssize_t)half;  // cut P in halves
+    const RepIterator Rmid=Rbeg+(ssize_t)halfR;	// cut R in halves
+
+    sqr(R, Rbeg, Rmid-1, 			// Recursive dynamic choice
+        P, Pbeg, Pmid);				// Pl^2 in first storage part of R
+
+    sqr(R, Rmid, Rend,				// Recursive dynamic choice
+        P, Pmid, Pend);				// Ph^2 in second storage part of R
+
+    Rep M(P.size());
+    mul(M, M.begin(), M.end(),                  // Recursive dynamic choice
+        P, Pbeg, Pmid,
+        P, Pmid, Pend);
+    setdegree(M);
+    this->mulin(M,two);
+    
+    RepIterator ri=Rbeg+(ssize_t)half;
+    RepConstIterator mi=M.begin();		// update R with mid product
+    for( ; mi != M.end(); ++ri, ++mi) _domain.addin(*ri, *mi);
+
+    return R;
+}
+
+// Standard square 
+template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::stdsqr(
+    Rep& R, const RepIterator Rbeg, const RepIterator Rend, 
+    const Rep& P, const RepConstIterator Pbeg, const RepConstIterator Pend,
+    const Type_t& two) const {
+
+    _domain.mul(*Rbeg, *Pbeg, *Pbeg);
+
+    RepIterator rit(Rbeg); 
+    RepConstIterator pit=Pbeg;
+    for(++rit,++pit; rit != Rend; ++pit, ++rit) {
+        
+        _domain.assign(*rit,_domain.zero);
+
+        RepConstIterator backpit=pit, forpit=pit;
+        for(--backpit ; forpit != Pend; --backpit, ++forpit) {
+            _domain.axpyin(*rit, *backpit, *forpit);
+            if (backpit == Pbeg) break;
         }
-       // Debut des tableaux :
-       T* R00 = R ;
-       T* R01 = R + k + 1 ;
-       T* R0 = R ;
-       T* R1 = R + 2*k + 2 ;
-       T* P0 = P ;
-       T* P1 = P + k+1 ;
-       const T* Q0 = Q ;
-       const T* Q1 = Q + k+1 ;
-
-       // P1-P0 -> R00
-       for (i=0 ; i < tP-k ; i++)     R00[i] = P1[i] - P0[i] ;
-       for (i=tP-k ; i <= k ; i++)    R00[i] = -P0[i] ;
-
-       // Q0-Q1 -> R01, degQ0 = k > degQ1 = tQ-k
-       for (i=0 ; i < tQ-k ; i++)     R01[i] = Q0[i] - Q1[i] ;
-       for (i=tQ-k ; i <= k ; i++)    R01[i] = Q0[i] ;
-
-       // Recursive calls
-       _karatsuba(R00, R01, Tmp1, R1, k, k) ;
-       _karatsuba(P0,  Q0,  R0,   R1, k, k) ;
-       _karatsuba(P1,  Q1,  R1,   P0, tP-k-1, tQ-k-1) ;
-
-       // Merge des termes
-       // Correction des termes du milieu:
-       for (i=0 ; i <=2*k ; i++) Tmp1[i] += R0[i] ;
-       for (i=0 ; i <=tP+tQ-2*k-2 ; i++) Tmp1[i] += R1[i] ;
-
-       // Mis a jour du resultat
-       R[2*k+1] = T(zero) ;
-       for (i=0 ; i <=2*k ; i++) R[i+k+1] += Tmp1[i] ;
-    }
-   else
-    {
-       int i ;
-       k = tQ/2 ;
-       if (tP <= k)
+        
+
+        _domain.mulin(*rit, two);            
+
+        ++rit;
+
+        _domain.assign(*rit,_domain.zero);
+         
+        backpit=pit, forpit=pit;
+        for(--backpit,++forpit; forpit != Pend; --backpit, ++forpit) 
         {
-//cout << "heheh : tP:" << tP << " tQ: " << tQ << endl  ;
-          _karatsuba(P, Q, R, Tmp1, tP, k) ;
-          _karatsuba(P, Q+k+1, Tmp1, P, tP, tQ-k-1) ;
-          for (i=0 ; i <= tP+tQ-k-1 ; i++) R[i+k+1] += Tmp1[i] ;
-          return ;
+            _domain.axpyin(*rit, *backpit, *forpit);
+            if (backpit == Pbeg) break;
         }
-       // Debut des tableaux :
-       T* R00 = R ;
-       T* R01 = R + k + 1 ;
-       T* R0 = R ;
-       T* R1 = R + 2*k + 2 ;
-       T* P0 = P ;
-       T* P1 = P + k+1 ;
-       const T* Q0 = Q ;
-       const T* Q1 = Q + k+1 ;
-
-       // P1-P0 -> R00
-       for (i=0 ; i < tP-k ; i++)     R00[i] = P1[i] - P0[i] ;
-       for (i=tP-k ; i <= k ; i++)    R00[i] = -P0[i] ;
-
-       // Q0-Q1 -> R01, degQ0 = k > degQ1 = tQ-k
-       for (i=0 ; i < tQ-k ; i++)     R01[i] = Q0[i] - Q1[i] ;
-       for (i=tQ-k ; i <= k ; i++)    R01[i] = Q0[i] ;
-
-       // Recursive calls
-       _karatsuba(R00, R01, Tmp1, R1, k, k) ;
-       _karatsuba(P0,  Q0,  R0,   R1, k, k) ;
-       _karatsuba(P1,  Q1,  R1,   P0, tP-k-1, tQ-k-1) ;
-
-       // Merge des termes
-       // Correction des termes du milieu:
-       for (i=0 ; i <=2*k ; i++) Tmp1[i] += R0[i] ;
-       for (i=0 ; i <=tP+tQ-2*k-2 ; i++) Tmp1[i] += R1[i] ;
-
-       // Mis a jour du resultat
-       R[2*k+1] = T(zero) ;
-       for (i=0 ; i <=2*k ; i++) R[i+k+1] += Tmp1[i] ;
-    }
-}
+        _domain.mulin(*rit, two);
+        _domain.axpyin(*rit, *pit, *pit);        
 
-template<class T>
-const Poly1<T> Karatsuba(const Poly1<T>& P, const Poly1<T>& Q)
-{
-   Degree degP = P.degree() ;
-   Degree degQ = Q.degree() ;
-
-   T* Res = new T[degP+degQ+1];
-   T* PP  = new T[degP+1];
-   T* Tmp1, *Tmp2 ;
-   if (degQ <= degP)
-    {
-        Tmp1 = new T[degP+1];
-//        Tmp2 = new T[degP+1];
-    }
-   else
-    {
-        Tmp1 = new T[degQ+1];
-//        Tmp2 = new T[degQ+1];
     }
-   int i ;
-   for (i=0 ; i<= degQ+degP ; i++) Res[i] = T(zero) ;
-   for (i=0 ; i<= degP ; i++) PP[i] = P[i] ;
-   _karatsuba(PP, Q.baseptr(), Res, Tmp1, degP, degQ) ;
-   Poly1<T> PRes(P.variable(), degP+degQ, Res) ;
-   delete [] Tmp1 ; delete [] PP ; delete [] Res ;
-   return PRes ;
+    
+
+
+//     for(size_t i=0; i<dR; ++i) {
+//             // even coefficients
+//         _domain.assign(R[i],_domain.zero);
+//         size_t iot(i>>1);
+//         size_t firstj( i>dP ? i-dP : 0);
+//         for(size_t j=firstj; j<iot; ++j)
+//             _domain.axpyin(R[i], P[j], P[i-j]);
+//         _domain.mulin(R[i], two);
+//         _domain.axpyin(R[i],P[iot],P[iot]);
+
+//             // odd coefficients
+//         ++i; ++iot;
+//         _domain.assign(R[i],_domain.zero);
+//         firstj = i>dP ? i-dP : 0;
+//         for(size_t j=firstj; j<iot; ++j) {
+//             _domain.axpyin(R[i], P[j], P[i-j]);
+//         }
+//         _domain.mulin(R[i], two);
+
+//     }
+//     _domain.mul(R[dR],P[dP],P[dP]);
+
+
+	return R;
 }
+
+
+
 }
 #endif // __GIVARO_poly1_kara_INL
diff --git a/src/library/poly1/givpoly1misc.inl b/src/library/poly1/givpoly1misc.inl
index 8449341..7d96e15 100644
--- a/src/library/poly1/givpoly1misc.inl
+++ b/src/library/poly1/givpoly1misc.inl
@@ -19,7 +19,7 @@ namespace Givaro {
 	template<class Domain>
 	inline int Poly1Dom<Domain,Dense>::isZero (const Rep& P) const
 	{
-		setdegree(const_cast<Rep&>(P));
+		setDegree(const_cast<Rep&>(P));
 		if (P.size() ==0) return 1;
 		if (P.size() ==1) return _domain.isZero(P[0]);
 		else return 0;
@@ -28,7 +28,7 @@ namespace Givaro {
 	template<class Domain>
 	inline int Poly1Dom<Domain,Dense>::isOne ( const Rep& P ) const
 	{
-		setdegree(const_cast<Rep&>(P));
+		setDegree(const_cast<Rep&>(P));
 		if (P.size() ==1)
 			return _domain.isOne(P[0]);
 		else
@@ -38,8 +38,8 @@ namespace Givaro {
 	template<class Domain>
 	inline int Poly1Dom<Domain,Dense>::areEqual (const Rep& P, const Rep& Q) const
 	{
-		setdegree(const_cast<Rep&>(P));
-		setdegree(const_cast<Rep&>(Q));
+		setDegree(const_cast<Rep&>(P));
+		setDegree(const_cast<Rep&>(Q));
 		if (P.size() != Q.size()) return 0;
 		for( typename Element::const_iterator pit = P.begin(), qit = Q.begin();
 		     pit != P.end();
@@ -52,8 +52,8 @@ namespace Givaro {
 	template<class Domain>
 	inline int Poly1Dom<Domain,Dense>::areNEqual (const Rep& P, const Rep& Q) const
 	{
-		setdegree(const_cast<Rep&>(P));
-		setdegree(const_cast<Rep&>(Q));
+		setDegree(const_cast<Rep&>(P));
+		setDegree(const_cast<Rep&>(Q));
 		if (P.size() != Q.size()) return 1;
 		for( typename Element::const_iterator pit = P.begin(), qit = Q.begin();
 		     pit != P.end();
@@ -69,12 +69,12 @@ namespace Givaro {
 	{
 		int sz = (int) (P.size() - 1);
 		if (P.size() <= 0) return P.reallocate(0);
-		if (_domain.isZero(P[sz]) ==0) {
+		if (_domain.isZero(P[(size_t)sz]) ==0) {
 			return P;
 		}
 		for (int j=sz; j--; )
-			if (_domain.isZero(P[j]) ==0) {
-				P.reallocate(j+1);
+			if (_domain.isZero(P[(size_t)j]) ==0) {
+				P.reallocate((size_t)j+1);
 				return P;
 			}
 		return P.reallocate(0);
@@ -87,21 +87,29 @@ namespace Givaro {
 		if (sz ==0) {
 			return deg = Degree::deginfty;
 		}
-		if (_domain.isZero(P[sz-1])) {
-			setdegree(const_cast<Rep&>(P));
+		if (_domain.isZero(P[(size_t)sz-1])) {
+			setDegree(const_cast<Rep&>(P));
 			sz = (int) P.size();
 		}
 		return deg = (Degree) (sz-1);
 	}
 
+	template <class Domain>
+	inline Degree Poly1Dom<Domain,Dense>::degree(const Rep& P) const
+	{
+            Degree d; return degree(d,P);
+	}
+
 
 	template<class Domain>
 	inline typename Poly1Dom<Domain,Dense>::Type_t& Poly1Dom<Domain,Dense>::leadcoef (Type_t& c, const Rep& P) const
 	{
 		Degree dP;
 		degree(dP, P);
-		if (dP == Degree::deginfty) return _domain.assign(c, _domain.zero);
-		else return _domain.assign(c, P[dP.value()]);
+		if (dP == Degree::deginfty)
+			return _domain.assign(c, _domain.zero);
+		else
+			return _domain.assign(c, P[(size_t)dP.value()]);
 	}
 
 
@@ -115,6 +123,33 @@ namespace Givaro {
 		else return _domain.assign(c, P[i.value()]);
 	}
 
+	template<class Domain>
+	inline typename Poly1Dom<Domain,Dense>::Type_t
+	Poly1Dom<Domain,Dense>::setEntry(Rep &P, const Type_t&c, const Degree&i) const
+	{
+		Degree dP;
+		degree(dP, P);
+
+		if (_domain.isZero(c)) {
+			if (dP < i) { /* nothing happens */
+				return c ;
+			}
+			else if (dP == i) { /* degree is killed */
+					_domain.assign(P[i.value()], c);
+					setDegree(P);
+					return c ;
+			}
+			else { /* element is killed */
+					return _domain.assign(P[i.value()], c);
+			}
+		}
+		/*  c != 0 */
+		if (dP < i) {
+			P.reallocate(i.value()+1);
+		}
+		return _domain.assign(P[i.value()], c);
+	}
+
 
 
 
@@ -131,7 +166,8 @@ namespace Givaro {
 		for (size_t i=1; i<sz; ++i)
 		{
 			if (!_domain.isZero(P[i])) {
-				return d = i;
+				// return d = (Degree)i;
+				return d = (long)i;
 			}
 		}
 		return d=0;
@@ -147,9 +183,9 @@ namespace Givaro {
 		Degree dP ; degree(dP, P);
 		if (dP == Degree::deginfty) _domain.assign(res, _domain.zero);
 		else {
-			_domain.assign(res, P[dP.value()]);
+			_domain.assign(res, P[(size_t)dP.value()]);
 			for (int i = (int)dP.value(); i--; )
-				_domain.assign(res,_domain.axpy(tmp, res, Val, P[i]));
+				_domain.assign(res,_domain.axpy(tmp, res, Val, P[(size_t)i]));
 		}
 		return res;
 	}
@@ -163,11 +199,11 @@ namespace Givaro {
 			P.reallocate(0);
 			return P;
 		}
-		P.reallocate(dQ.value());
+		P.reallocate((size_t)dQ.value());
 		Type_t cste; _domain.assign(cste, _domain.zero);
 		for (int i=0; dQ>i; ++i) {
 			_domain.add(cste, cste, _domain.one);
-			_domain.mul(P[i], Q[i+1], cste);
+			_domain.mul(P[(size_t)i], Q[(size_t)i+1], cste);
 		}
 		return P;
 	}
@@ -218,15 +254,15 @@ namespace Givaro {
 			n.copy(q);
 			if (! ID.isZero(r)) {
 				mulin(W,puiss);
-				mod(tmp, W, U);
-				assign(W,tmp);
+                modin(W,U);
 			}
-			mul(tmp,puiss,puiss);
+//			mul(tmp,puiss,puiss);
+			sqr(tmp,puiss);
 			mod(puiss,tmp,U);
 		}
 
 		// write(cerr << "W: ", W) << "\n----------- END POWMOD -----------" <<  endl;
-		return setdegree(W);
+		return setDegree(W);
 	}
 
 
@@ -250,7 +286,7 @@ namespace Givaro {
 	template <class Domain> template<class RandIter>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::random(RandIter& g, typename Poly1Dom<Domain,Dense>::Rep& r, Degree d) const
 	{
-		r.reallocate(d.value()+1);
+		r.reallocate((size_t)d.value()+1);
 		typename Domain::Element tmp;
 		while (_domain.isZero(g.random(tmp))) ;
 		r[d.value()] = tmp;
@@ -267,10 +303,10 @@ namespace Givaro {
 	template <class Domain>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::random(GivRandom& g, Rep& r, Degree d) const
 	{
-		r.reallocate(d.value()+1);
-		_domain.nonzerorandom(g, r[d.value()]);
+		r.reallocate((size_t)d.value()+1);
+		_domain.nonzerorandom(g, r[(size_t)d.value()]);
 		for (int i= (int)d.value(); i--;)
-			_domain.random(g,r[i]);
+			_domain.random(g,r[(size_t)i]);
 		return r;
 	}
 
@@ -278,7 +314,7 @@ namespace Givaro {
 	template <class Domain> template<class RandIter>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::random(RandIter& g, Rep& r, Degree d) const
 	{
-		r.reallocate(d.value()+1);
+		r.reallocate((size_t)d.value()+1);
 		while (_domain.isZero(_domain.init(r[d.value()], g()))) {};
 		for (int i=d.value(); i--;)
 			_domain.init(r[i],g());
@@ -328,10 +364,10 @@ namespace Givaro {
 	template <class Domain>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::reverse( Rep& P, const Rep& Q) const {
 
-		//     this->setdegree(Q);
+		//     this->setDegree(Q);
 		P.resize(Q.size());
 		std::reverse_copy(Q.begin(), Q.end(), P.begin());
-		this->setdegree(P);
+		this->setDegree(P);
 		return P;
 	}
 
@@ -340,9 +376,9 @@ namespace Givaro {
 	template <class Domain>
 	inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::reversein( Rep& P) const
 	{
-		this->setdegree(P);
+		this->setDegree(P);
 		std::reverse(P.begin(), P.end());
-		this->setdegree(P);
+		this->setDegree(P);
 		return P;
 	}
 
diff --git a/src/library/poly1/givpoly1muldiv.inl b/src/library/poly1/givpoly1muldiv.inl
index a435edc..e54a60d 100644
--- a/src/library/poly1/givpoly1muldiv.inl
+++ b/src/library/poly1/givpoly1muldiv.inl
@@ -60,7 +60,7 @@ Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R, const Rep& P,
 	size_t sP = P.size();
 	size_t sQ = Q.size();
 	if ((sQ ==0) || (sP ==0)) { R.reallocate(0); return R; }
-	if (sR != sQ+sP) R.reallocate(sR = sP+sQ-1);
+	if (sR != sQ+sP) R.reallocate((size_t)sR = sP+sQ-1);
 
 	size_t i,j;
 	for (i=0; i<sR; ++i) _domain.assign(R[i], _domain.zero);
@@ -73,6 +73,18 @@ Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R, const Rep& P,
 #endif
 
 template <class Domain>
+inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::sqr( Rep& R, const Rep& P) const
+{
+    const size_t sP = P.size();
+    if (sP ==0) { R.reallocate(0); return R; }
+    size_t sR = sP<<1;
+    if (R.size() != --sR) R.reallocate(sR);
+    
+        // Generic square handler
+    return sqr(R, R.begin(), R.end(), P, P.begin(), P.end());
+}
+
+template <class Domain>
 inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R, const Rep& P, const Rep& Q ) const
 {
 	size_t sR = R.size();
@@ -81,26 +93,16 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R
 	if ((sQ ==0) || (sP ==0)) { R.reallocate(0); return R; }
 	if (sR != sQ+sP) R.reallocate(sR = sP+sQ-1);
 
-	typename Rep::const_iterator ai=P.begin(),bi=Q.begin();
-	typename Rep::iterator ri=R.begin(), rig=R.begin();
-	if (_domain.isZero(*ai))
-		for(;bi!=Q.end();++bi,++ri)
-			*ri = _domain.zero;
-	else
-		for(;bi!=Q.end();++bi,++ri)
-			if (_domain.isZero(*bi))
-				*ri = _domain.zero;
-			else
-				_domain.mul(*ri,*ai,*bi);
-	for(;ri!=R.end();++ri)
-		*ri = _domain.zero;
-	for(++ai,++rig;ai!=P.end();++ai,++rig)
-		if (! _domain.isZero(*ai))
-			for(ri=rig,bi=Q.begin();bi!=Q.end();++bi,++ri)
-				_domain.axpyin(*ri,*ai,*bi);
-	return setdegree(R);
+        // Generic multiplication handler
+        // Can use e.g. Karatsuba multiplication
+ 	mul(R, R.begin(), R.end(),
+            P, P.begin(), P.end(),
+            Q, Q.begin(), Q.end());
+
+        return setdegree(R);
 }
 
+// Compute truncated mul: only the coefficients inside the degree interval, included
 template <class Domain>
 inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R, const Rep& P, const Rep& Q, const Degree& Val, const Degree& deg) const
 {
@@ -108,21 +110,21 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R
 	size_t sP = P.size();
 	size_t sQ = Q.size();
 	if ((sQ ==0) || (sP ==0)) { R.reallocate(0); return R; }
-	size_t newS = value(deg-Val)+1;
+	size_t newS = (size_t)value(deg-Val)+1;
 	if (sR != newS) R.reallocate(sR = newS);
 	for(typename Rep::iterator ri=R.begin(); ri!= R.end(); ++ri)
 		*ri = _domain.zero;
 
 	for(size_t i=0; i<sR; ++i) {
-		long k=i+Val.value();
+		long k=(long)i+Val.value();
 		size_t j=0;
 		if (static_cast<size_t>(k)>=sQ) {
-			j=k;
-			k=sQ-1;
-			j-=k;
+			j=static_cast<size_t>(k);
+			k=long(sQ-1);
+			j-=(size_t)k;
 		}
 		for( ; (j<sP) && (k>=0); ++j,--k) {
-			_domain.axpyin(R[i],P[j],Q[k]);
+			_domain.axpyin(R[(size_t)i],P[(size_t)j],Q[(size_t)k]);
 		}
 	}
 	return setdegree(R);
@@ -130,24 +132,24 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul( Rep& R
 
 template <class Domain>
 inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul
-( Rep& R, const Rep& P, const Type_t& Val ) const
+( Rep& R, const Rep& P, const Type_t& u ) const
 {
 	typename Rep::const_iterator ip = P.begin();
 	R.resize(P.size());
 	for(typename Rep::iterator ir = R.begin(); ir != R.end(); ++ir, ++ip)
-		this->_domain.mul(*ir, *ip, Val);
+		this->_domain.mul(*ir, *ip, u);
 	return R;
 }
 
 template <class Domain>
 inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::mul
-( Rep& R, const Type_t& Val, const Rep& P ) const
+( Rep& R, const Type_t& u, const Rep& P ) const
 {
-	return this->mul(R,P,Val);
+	return this->mul(R,P,u);
 }
 } // Givaro
 
-#include <typeinfo>
+//#include <typeinfo>
 
 namespace Givaro {
 
@@ -171,7 +173,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::div(Rep& R,
 	if (_domain.isZero(u)) GivError::throw_error(GivMathDivZero("[Poly1Dom<D>::div]"));
 #endif
 	size_t sP =P.size();
-	R.reallocate(sP);
+	R.reallocate((size_t)sP);
 	for (unsigned int i=0; i<sP; ++i)
 		_domain.div(R[i],P[i],u);
 	return setdegree(R);
@@ -266,7 +268,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::modin(Rep&
 	// Last step is erasing of the first values.
 	//     write(std::cerr << "Rem(", A) << " ,";
 	//     write(std::cerr, B) << ", X) mod " << _domain.size();
-	long i = A.size()-B.size();
+	long i = (long)(A.size()-B.size());
 	if (i >= 0) {
 		typedef typename Rep::value_type TT;
 		TT l;
@@ -289,7 +291,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::modin(Rep&
 			*aai = _domain.zero;
 		}
 		//         write(std::cerr << " = ", A) << ";" << std::endl;
-		A.erase(A.begin(), A.begin()+(A.size()-B.size()-i));
+		A.erase(A.begin(), A.begin()+(ssize_t)(A.size()-B.size()-(size_t)i));
 	}
 	//     write(std::cerr << " = ", setdegree(A)) << ";" << std::endl;
 	return setdegree(A);
@@ -348,7 +350,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::divmod( Rep
 
 	long degQuo = value(degA-degB);
 	long degRem = value(degA);
-	Q.reallocate(degQuo+1);
+	Q.reallocate((size_t)degQuo+1);
 
 	assign(R,A);
 	// write(std::cerr << "A:=", A) << "; # of degA " << degA << std::endl;
@@ -357,18 +359,19 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::divmod( Rep
 	for (long i=degQuo; i>=0; --i)
 	{
 		// == ld X^ (degRem-degQ)
-		_domain.div(Q[i], R[degRem], B[degB.value()]);
+		_domain.div(Q[(size_t)i], R[(size_t)degRem], B[(size_t)degB.value()]);
 		// _domain.write(std::cerr << "Q[" << i << "]:=", Q[i]) << ';' << std::endl;
 		//  std::cerr << "degB: " << degB << std::endl;
 		for (long j=0; degB>j; ++j) { // rem <- rem - ld*x^(degRem-degB)*B
-			_domain.maxpyin(R[j+i], Q[i], B[j]);
+			_domain.maxpyin(R[(size_t)(j+i)], Q[(size_t)i], B[(size_t)j]);
 		}
-		_domain.assign(R[degRem],_domain.zero) ; --degRem;
+		_domain.assign(R[(size_t)degRem],_domain.zero) ;
+		--degRem;
 		// write(std::cerr << "inR:=", R) << ';' << std::endl;
 	}
 	// write(std::cerr << "Q:=", Q) << "; # of degQ " << degQuo << std::endl;
 	// write(std::cerr << "R:=", R) << "; # of degR " << degRem << std::endl;
-	R.reallocate(degRem+1);
+	R.reallocate((size_t)degRem+1);
 	setdegree(R);
 	//     std::cerr << "END divmod of " << typeid(*this).name() << std::endl;
 	return setdegree(Q);
@@ -412,7 +415,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::divmodin( R
 
 	long degQuo = value(degA-degB);
 	long degRem = value(degA);
-	Q.reallocate(degQuo+1);
+	Q.reallocate((size_t)degQuo+1);
 
 	// write(std::cerr << "A:=", A) << "; # of degA " << degA << std::endl;
 	// write(std::cerr << "B:=", B) << "; # of degB " << degB << std::endl;
@@ -420,18 +423,18 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::divmodin( R
 	for (long i=degQuo; i>=0; --i)
 	{
 		// == ld X^ (degRem-degQ)
-		_domain.div(Q[i], R[degRem], B[degB.value()]);
+		_domain.div(Q[(size_t)i], R[(size_t)degRem], B[(size_t)degB.value()]);
 		// _domain.write(std::cerr << "Q[" << i << "]:=", Q[i]) << ';' << std::endl;
 		//  std::cerr << "degB: " << degB << std::endl;
 		for (long j=0; degB>j; ++j) { // rem <- rem - ld*x^(degRem-degB)*B
-			_domain.maxpyin(R[j+i], Q[i], B[j]);
+			_domain.maxpyin(R[(size_t)(j+i)], Q[(size_t)i], B[(size_t)j]);
 		}
-		_domain.assign(R[degRem],_domain.zero) ; --degRem;
+		_domain.assign(R[(size_t)degRem],_domain.zero) ; --degRem;
 		// write(std::cerr << "inR:=", R) << ';' << std::endl;
 	}
 	// write(std::cerr << "Q:=", Q) << "; # of degQ " << degQuo << std::endl;
 	// write(std::cerr << "R:=", R) << "; # of degR " << degRem << std::endl;
-	R.reallocate(degRem+1);
+	R.reallocate((size_t)degRem+1);
 	setdegree(R);
 	//     std::cerr << "END divmod of " << typeid(*this).name() << std::endl;
 	return setdegree(Q);
@@ -474,7 +477,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::pdivmod
 
 	long degQuo = value(degA-degB);
 	long degRem = value(degA);
-	Q.reallocate(degQuo+1);
+	Q.reallocate((size_t)degQuo+1);
 	assign(R,A);
 
 	Type_t tmp, lB;
@@ -497,7 +500,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::pdivmod
 		_domain.assign(R[degRem],_domain.zero); degQuo--; degRem--;
 		_domain.mulin(m, lB);
 	}
-	R.reallocate(degRem+1);
+	R.reallocate((size_t)degRem+1);
 	setdegree(R);
 	return setdegree(Q);
 	//  Poly1Dom<Domain,Dense>::Rep U,V;
@@ -563,7 +566,7 @@ inline typename Poly1Dom<Domain,Dense>::Rep& Poly1Dom<Domain,Dense>::pmod
 		_domain.assign(R[degR.value()],_domain.zero);
 		degree(degR, R);
 	}
-	R.reallocate(degR.value()+1);
+	R.reallocate((size_t)degR.value()+1);
 	return setdegree(R);
 }
 
diff --git a/src/library/poly1/givpoly1padic.h b/src/library/poly1/givpoly1padic.h
index 789ead8..8b1f761 100644
--- a/src/library/poly1/givpoly1padic.h
+++ b/src/library/poly1/givpoly1padic.h
@@ -7,6 +7,11 @@
 // Time-stamp: <11 Jun 10 14:43:52 Jean-Guillaume.Dumas at imag.fr>
 // ================================================================= //
 
+/** @file givpoly1padic.h
+ * @ingroup poly1
+ * @brief NO DOC.
+ */
+
 #ifndef __GIVARO_poly1_p_adic_H
 #define __GIVARO_poly1_p_adic_H
 #include <givaro/givinteger.h>
@@ -18,6 +23,7 @@ namespace Givaro {
 
 template<class Domain, class Tag=Dense> class Poly1PadicDom;
 
+//! Poly1 p-adic.
 template<class Domain>
 class Poly1PadicDom<Domain,Dense> : public Poly1Dom<Domain,Dense>, public IntegerDom {
     using Poly1Dom<Domain,Dense>::_domain;
@@ -61,7 +67,7 @@ public:
         _domain.convert(E,*pi);
         for (++pi;pi != P.rend();++pi) {
             E *= _domain.size();
-            E += _domain.convert(*pi);
+            E += (unsigned long)_domain.convert(*pi);
         }
         return E;
     }
@@ -72,7 +78,7 @@ public:
         _domain.convert(E,*pi);
         for (++pi;pi != P.rend();++pi) {
             E *= _domain.size();
-            E += _domain.convert(*pi);
+            E += (unsignedinttype)_domain.convert(*pi);
         }
         return E;
     }
@@ -111,11 +117,11 @@ public:
             IntegerDom::divmod(iq, ir, E, q);
             radix(Q, iq, n-t);
             radix(P, ir, t);
-            Degree dp; degree(dp,P); ++dp;
+            Degree dp; this->degree(dp,P); ++dp;
             for(long i=t; dp<i; --i)
                 P.push_back(_domain.zero);
         P.insert(P.end(),Q.begin(),Q.end());
-        return setdegree(P);
+        return this->setdegree(P);
     }
 
 
@@ -131,7 +137,7 @@ public:
         }
         double iq, ir;
         vect Q;
-            long t = (n+1)/2;
+            long t = (long)(n+1)/2;
             double q = std::pow(double(_domain.size()), double(t));
             iq = floor( E / q );
             ir = E - iq*q;
diff --git a/src/library/poly1/givpoly1proot.inl b/src/library/poly1/givpoly1proot.inl
index 5f9e939..7fd73d4 100644
--- a/src/library/poly1/givpoly1proot.inl
+++ b/src/library/poly1/givpoly1proot.inl
@@ -36,7 +36,7 @@ namespace Givaro {
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_binomial (Element& R, Degree n, Residue MOD) const
 	{
 		for(Residue a=0; a<MOD; ++a) {
-			_domain.assign(R[0],a);
+			_domain.assign(R[0],(Element_t)a);
 			if (is_irreducible(R))
 				return true;
 		}
@@ -55,7 +55,7 @@ namespace Givaro {
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_binomial (Element& R, Degree n, Residue MOD, Element IXE) const
 	{
 		for(Residu_t a=0; a<MOD; ++a) {
-			_domain.assign(R[0],a);
+			_domain.assign(R[0],static_cast<Element_t>(a));
 			if (is_irreducible(R) && (is_prim_root(IXE,R) ))
 				return true;
 		}
@@ -76,7 +76,7 @@ namespace Givaro {
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_binomial2 (Element& R, Degree n, Residue MOD, Element IXE) const
 	{
 		for(Residu_t a=0; a<MOD; ++a) {
-			_domain.assign(R[0],a);
+			_domain.assign(R[0],(Element_t)a);
 			if (is_irreducible2(R) && (is_prim_root(IXE,R) ))
 				return true;
 		}
@@ -102,16 +102,16 @@ namespace Givaro {
 
 		for(long d=1;d<=(n.value()/2);++d) {
 			for(Residu_t b=0; b<MOD; ++b) {
-				_domain.assign(R[d],b);
+				_domain.assign(R[(size_t)d],(Element_t)b);
 				for(Residu_t a=1; a<MOD; ++a) {
-					_domain.assign(R[0],a);
+					_domain.assign(R[0],(Element_t)a);
 					if (is_irreducible(R))
 						return true;
 				}
 			}
 			// _domain.assign(R[0],_domain.zero);
 			// JGD 21.10.02
-			_domain.assign(R[d],_domain.zero);
+			_domain.assign(R[(size_t)d],_domain.zero);
 		}
 		return false ;
 	}
@@ -123,10 +123,10 @@ namespace Givaro {
 
 		_domain.assign(R[0],_domain.one);
 		for(long d=1;d<=(n.value()/2);++d) {
-			_domain.assign(R[d],_domain.one);
+			_domain.assign(R[(size_t)d],_domain.one);
 			if (is_irreducible(R))
 				return true;
-			_domain.assign(R[d],_domain.zero);
+			_domain.assign(R[(size_t)d],_domain.zero);
 		}
 		return false ;
 	}
@@ -137,16 +137,16 @@ namespace Givaro {
 	{
 		for(long d=2;d<=(n.value()/2);++d) {
 			for(Residu_t b=0; b<MOD; ++b) {
-				_domain.assign(R[d],b);
+				_domain.assign(R[(size_t)d],(Element_t)b);
 				for(Residu_t a=1; a<MOD; ++a) {
-					_domain.assign(R[0],a);
+					_domain.assign(R[0],(Element_t)a);
 					if (is_irreducible(R) && (is_prim_root(IXE,R) ))
 						return true;
 				}
 			}
 			// _domain.assign(R[0],_domain.zero);
 			// JGD 21.10.02
-			_domain.assign(R[d],_domain.zero);
+			_domain.assign(R[(size_t)d],_domain.zero);
 		}
 		return false;
 	}
@@ -158,10 +158,10 @@ namespace Givaro {
 
 		_domain.assign(R[0],_domain.one);
 		for(long d=2;d<=(n.value()/2);++d) {
-			_domain.assign(R[d],_domain.one);
+			_domain.assign(R[(size_t)d],_domain.one);
 			if (is_irreducible(R) && (is_prim_root(IXE,R) ))
 				return true;
-			_domain.assign(R[d],_domain.zero);
+			_domain.assign(R[(size_t)d],_domain.zero);
 		}
 		return false ;
 	}
@@ -172,9 +172,9 @@ namespace Givaro {
 	{
 		for(long d=2;d<n.value();++d) {
 			for(Residu_t b=0; b<MOD; ++b) {
-				_domain.assign(R[d],b);
+				_domain.assign(R[(size_t)d],(Element_t)b);
 				for(Residu_t a=1; a<MOD; ++a) {
-					_domain.assign(R[0],a);
+					_domain.assign(R[0],(Element_t)a);
 					if (is_irreducible2(R) && (is_prim_root(IXE,R) ))
 						return true;
 				}
@@ -192,10 +192,10 @@ namespace Givaro {
 
 		_domain.assign(R[0],_domain.one);
 		for(long d=2;d<=n.value();++d) {
-			_domain.assign(R[d],_domain.one);
+			_domain.assign(R[(size_t)d],_domain.one);
 			if (is_irreducible2(R) && (is_prim_root(IXE,R) ))
 				return true;
-			_domain.assign(R[d],_domain.zero);
+			_domain.assign(R[(size_t)d],_domain.zero);
 		}
 		return false ;
 	}
@@ -207,20 +207,20 @@ namespace Givaro {
 	template<class Residue>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial (Element& R, Degree n, Residue MOD) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop =(int) n.value()/2+5 ;
 #endif
 
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			for(Residu_t a=0; a<MOD; ++a) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_irreducible(R))
 					return true;
 			}
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -233,18 +233,18 @@ namespace Givaro {
 	// template<>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial (Element& R, Degree n, bool MOD) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop = n.value()/2+5 ;
 #endif
 
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			_domain.assign(R[0],_domain.one);
 			if (is_irreducible(R))
 				return true;
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -257,19 +257,19 @@ namespace Givaro {
 	template<class Residue>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial (Element& R, Degree n, Residue MOD, Element IXE) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop = (int)n.value()/2+5 ;
 #endif
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			for(Residu_t a=0; a<MOD; ++a) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_irreducible(R) && (is_prim_root(IXE,R) ))
 					return true;
 			}
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -282,18 +282,18 @@ namespace Givaro {
 	// template<>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial (Element& R, Degree n, bool MOD, Element IXE) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop = n.value()/2+5 ;
 #endif
 
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			_domain.assign(R[0],_domain.one);
 			if (is_irreducible(R) && (is_prim_root(IXE,R) ))
 				return true;
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -306,19 +306,19 @@ namespace Givaro {
 	template<class Residue>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial2 (Element& R, Degree n, Residue MOD, Element IXE) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop = n.value()/2+5 ;
 #endif
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			for(Residu_t a=0; a<MOD; ++a) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_irreducible2(R) && (is_prim_root(IXE,R) ))
 					return true;
 			}
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -331,17 +331,17 @@ namespace Givaro {
 	// template<>
 	inline bool Poly1FactorDom<Domain,Tag, RandIter>::find_irred_randomial2 (Element& R, Degree n, bool MOD, Element IXE) const
 	{
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		int no_inf_loop = n.value()/2+5 ;
 #endif
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			_domain.assign(R[0],_domain.one);
 			if (is_irreducible2(R) && (is_prim_root(IXE,R) ))
 				return true;
 		}
-#ifdef DEBUG
+#ifdef INFLOOPDEBUG
 		while(--no_inf_loop);
 #else
 		while(1);
@@ -362,7 +362,7 @@ namespace Givaro {
 	template<class Domain, class Tag, class RandIter >
 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Element& Poly1FactorDom<Domain,Tag, RandIter>::creux_random_irreducible (Element& R, Degree n) const
 	{
-		init(R, n);
+		this->init(R, n);
 
 		Residu_t MOD = _domain.residu();
 
@@ -398,7 +398,7 @@ namespace Givaro {
 	{
 		// Search for a monic irreducible Polynomial
 		// with random Elements
-		init(R, n);
+		this->init(R, n);
 		Residu_t MOD = _domain.residu();
 
 		if (find_irred_randomial(R,n,MOD))
@@ -417,9 +417,9 @@ namespace Givaro {
 	template<class Domain, class Tag, class RandIter >
 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Element& Poly1FactorDom<Domain,Tag, RandIter>::ixe_irreducible (Element& R, Degree n) const
 	{
-		init(R, n);
+		this->init(R, n);
 		Element IXE;
-		init(IXE,Degree(1));
+		this->init(IXE,Degree(1));
 		Residu_t MOD = _domain.residu();
 
 		// Search for an irreducible BINOMIAL : X^n + a
@@ -442,8 +442,6 @@ namespace Givaro {
 
 		// Search for a monic irreducible Polynomial
 		// with random Elements
-
-
 		if (find_irred_randomial(R,n,MOD,IXE))
 			return R ;
 		else
@@ -455,9 +453,9 @@ namespace Givaro {
 	template<class Domain, class Tag, class RandIter >
 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Element& Poly1FactorDom<Domain,Tag, RandIter>::ixe_irreducible2 (Element& R, Degree n) const
 	{
-		init(R, n);
+		this->init(R, n);
 		Element IXE;
-		init(IXE,Degree(1));
+		this->init(IXE,Degree(1));
 		Residu_t MOD = _domain.residu();
 
 		// Search for an irreducible BINOMIAL : X^n + a
@@ -498,16 +496,16 @@ namespace Givaro {
 		// Square free ?
 		Rep W,D; this->gcd(W,diff(D,P),P);
 		Degree d, dP;
-		if (degree(d,W) > 0) return 0;
+		if (this->degree(d,W) > 0) return 0;
 		IntFactorDom<> FD;
 
-		long n = degree(dP,P).value();
+		long n = this->degree(dP,P).value();
 		IntFactorDom<>::Rep qn;
 
 		FD.pow( qn, IntFactorDom<>::Rep(MOD), n);
-		Rep Unit, G1; init(Unit, Degree(1));
+		Rep Unit, G1; this->init(Unit, Degree(1));
 		this->powmod(G1, Unit, qn, P);
-		if (degree(d, sub(D,G1,Unit)) >= 0) return 0;
+		if (this->degree(d, sub(D,G1,Unit)) >= 0) return 0;
 
 		std::vector<IntFactorDom<>::Rep> Lp; std::vector<unsigned long> Le;
 		FD.set(Lp, Le, n );
@@ -515,7 +513,7 @@ namespace Givaro {
 			long ttmp;
 			FD.pow( qn, IntFactorDom<>::Rep(MOD), n/FD.convert(ttmp,*p) );
 			this->powmod(G1, Unit, qn, P);
-			if (degree(d, sub(D,G1,Unit)) < 0) return 0;
+			if (this->degree(d, sub(D,G1,Unit)) < 0) return 0;
 		}
 
 		return 1;
@@ -534,13 +532,13 @@ namespace Givaro {
 	{
 		bool isproot = 0;
 		Rep A, G;
-		mod(A,P,F);
+		this->mod(A,P,F);
 		Degree d;
-		if ( degree(d, this->gcd(G,A,F)) == 0) {
+		if ( this->degree(d, this->gcd(G,A,F)) == 0) {
 			Residu_t MOD = _domain.residu();
 			IntFactorDom<> FD;
 			IntFactorDom<>::Element IMOD( MOD ), q, qp;
-			degree(d,F);
+			this->degree(d,F);
 			//         FD.pow(q ,IMOD, d.value());
 			//         FD.sub(qp, q, FD.one);
 			FD.subin( FD.pow(qp ,IMOD, d.value()) , FD.one);
@@ -562,11 +560,11 @@ namespace Givaro {
 		bool isproot = 0;
 		Rep A, G; mod(A,P,F);
 		Degree d;
-		if ( degree(d, this->gcd(G,A,F)) == 0) {
+		if ( this->degree(d, this->gcd(G,A,F)) == 0) {
 			Residu_t MOD = _domain.residu();
 			IntFactorDom<> FD;
 			IntFactorDom<>::Element IMOD( MOD ), g, gg, tt, qp;
-			degree(d,F);
+			this->degree(d,F);
 			//         FD.pow(q ,IMOD, d.value());
 			//         FD.sub(qp, q, FD.one);
 			FD.subin( FD.pow(qp ,IMOD, d.value()) , FD.one);
@@ -594,31 +592,31 @@ namespace Givaro {
 	template<class Domain, class Tag, class RandIter >
 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain,Tag, RandIter>::give_prim_root(Rep& R, const Rep& F)  const
 	{
-		Degree n; degree(n,F);
+		Degree n; this->degree(n,F);
 		Residu_t MOD = _domain.residu();
 		//    this->write(std::cout << "Give Pr: ", F) << std::endl;
 
 
 		// Search for a primitive BINOMIAL : X^i + a
 		for(Degree di=1;di<n;++di) {
-			init(R, di);
+			this->init(R, di);
 			//         for(Residu_t a=MOD; a--; )
 			for(Residu_t a=0; a<MOD;++a ) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_prim_root(R,F))
 					return R;
 			}
 		}
 		// Search for a primitive TRINOMIAL : X^i + b*X^j + a
 		for(Degree di=2;di<n;++di) {
-			init(R, di);
+			this->init(R, di);
 			for(Degree dj=1;dj<di;++dj)
 				//             for(Residu_t b=MOD; b--;)
 				for(Residu_t b=0; b<MOD;++b) {
-					_domain.assign(R[dj.value()],b);
+					_domain.assign(R[(size_t)dj.value()],(Element_t)b);
 					//                 for(Residu_t a=MOD; a--;)
 					for(Residu_t a=0; a<MOD;++a ) {
-						_domain.assign(R[0],a);
+						_domain.assign(R[0],(Element_t)a);
 						if (is_prim_root(R,F))
 							return R;
 					}
@@ -629,9 +627,9 @@ namespace Givaro {
 		// with random Elements
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			for(Residu_t a=0; a<MOD; ++a) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_prim_root(R,F))
 					return R;
 			}
@@ -642,16 +640,16 @@ namespace Givaro {
 	template<class Domain, class Tag, class RandIter >
 	inline typename Poly1FactorDom<Domain,Tag, RandIter>::Rep& Poly1FactorDom<Domain,Tag, RandIter>::give_random_prim_root(Rep& R, const Rep& F)  const
 	{
-		Degree n; degree(n,F);
+		Degree n; this->degree(n,F);
 		Residu_t MOD = _domain.residu();
 
 		// Search for a primitive Polynomial
 		// with random Elements
 		do {
 			this->random( (RandIter&)_g, R, n); // must cast away const
-			_domain.assign(R[n.value()],_domain.one);
+			_domain.assign(R[(size_t)n.value()],_domain.one);
 			for(Residu_t a=0; a<MOD; ++a) {
-				_domain.assign(R[0],a);
+				_domain.assign(R[0],(Element_t)a);
 				if (is_prim_root(R,F))
 					return R;
 			}
diff --git a/src/library/poly1/givpoly1sqrfree.inl b/src/library/poly1/givpoly1sqrfree.inl
index 0b6dc7d..0ffc10e 100644
--- a/src/library/poly1/givpoly1sqrfree.inl
+++ b/src/library/poly1/givpoly1sqrfree.inl
@@ -13,17 +13,7 @@
 #define __GIVARO_poly1_sqrfree_INL
 
 namespace Givaro {
-/** Sqrfree decomposition.
-Decompose P such that: P = Fact[0]^0 * Fact[1]^1 * ... * Fact[P.degree()]^(P.degree()),
-with Fact[0] the leading coefficient.
-The array Fact must be allocated before calling the function.
-The size of Fact must be degP+1 is all factors should be computed.
-For more readeable version of the algorithm, see Geddes, p342.
- at param Nfact [in] the size of Fact
- at param Fact  [in] an array of dimension Nfact
- at param Nfact [out] is the number of factor in the sqrfree decomposition
- at param Fact  [out] contains at most Nfact factors of the decomposition.
-*/
+
 template <class Domain>
 size_t& Poly1Dom<Domain,Dense>::sqrfree(size_t& Nfact, Rep* Fact, const Rep& P) const
 {
@@ -76,6 +66,7 @@ size_t& Poly1Dom<Domain,Dense>::sqrfree(size_t& Nfact, Rep* Fact, const Rep& P)
 //write(cout << "L" << count << ":", Fact[count]) << endl;
   return Nfact = ++count;
 }
+
 } // Givaro
 
 #endif // __GIVARO_poly1_sqrfree_INL
diff --git a/src/library/tools/Makefile.in b/src/library/tools/Makefile.in
index 692adc3..e83ed85 100644
--- a/src/library/tools/Makefile.in
+++ b/src/library/tools/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,9 +23,27 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -59,6 +77,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgivtools_la_LIBADD =
 am_libgivtools_la_OBJECTS = givops.lo
@@ -77,14 +96,39 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgivtools_la_SOURCES)
 DIST_SOURCES = $(libgivtools_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -118,6 +162,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -153,6 +198,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -242,9 +288,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/library/tools/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/library/tools/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/library/tools/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/library/tools/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -262,6 +308,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -271,7 +318,7 @@ clean-noinstLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgivtools.la: $(libgivtools_la_OBJECTS) $(libgivtools_la_DEPENDENCIES) 
+libgivtools.la: $(libgivtools_la_OBJECTS) $(libgivtools_la_DEPENDENCIES) $(EXTRA_libgivtools_la_DEPENDENCIES) 
 	$(CXXLINK)  $(libgivtools_la_OBJECTS) $(libgivtools_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -296,21 +343,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -324,7 +375,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -332,29 +383,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -375,13 +431,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -402,16 +462,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -501,6 +567,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/library/tools/givfractiondomain.h b/src/library/tools/givfractiondomain.h
index c763db3..3fce377 100644
--- a/src/library/tools/givfractiondomain.h
+++ b/src/library/tools/givfractiondomain.h
@@ -49,6 +49,7 @@ public :
 	// -- Constantes
 	const Rep zero;
 	const Rep one;
+	const Rep mOne;
 
 	void reduce(Ring_E& a, Ring_E& b) const
 	{
@@ -71,8 +72,8 @@ public :
 	}
 
 
-	FracDom (const RingDom& R ) : Ring_t(R), zero(R.zero,R.one), one(R.one,R.one) {}
-	FracDom (const Self_t& F) : Ring_t(static_cast<const Ring_t&>(F)), zero(F.zero), one(F.one) {}
+	FracDom (const RingDom& R ) : Ring_t(R), zero(R.zero,R.one), one(R.one,R.one) , mOne(R.mOne,R.one){}
+	FracDom (const Self_t& F) : Ring_t(static_cast<const Ring_t&>(F)), zero(F.zero), one(F.one), mOne(F.mOne) {}
 	const Ring_t& getdomain() const
 	{ return static_cast<const Ring_t&>(*this); }
 	const Ring_t& getring() const
@@ -483,7 +484,7 @@ public :
 		// -- W <-- P^n
 		Rep& pow( Rep& W, const Rep& P, long n) const
 		{
-			unsigned long l = GIVABS(n);
+			unsigned long l = (unsigned long)GIVABS(n);
 			if (n>0) {
 				dom_power(W._num,P._num,l,static_cast<Ring_t&>(*this));
 				dom_power(W._den,P._den,l,static_cast<Ring_t&>(*this));
diff --git a/src/library/tools/givhighorder.h b/src/library/tools/givhighorder.h
index 6502862..77d5612 100644
--- a/src/library/tools/givhighorder.h
+++ b/src/library/tools/givhighorder.h
@@ -63,16 +63,16 @@ struct HighOrder {
 
     Polynomial& taylor(Polynomial& Tay, const Rep& Fra, Degree order) const {
         Degree d; _poldom.degree(d,Fra._den);
-        Tay.resize(order.value()+1);
+        Tay.resize((size_t)order.value()+1);
         size_t i = 0;
-        for( ; (i<Fra._num.size()) && (order>=i); ++i) {
+        for( ; (i<Fra._num.size()) && (order>=(long)i); ++i) {
             _dom.assign(Tay[i],Fra._num[i]);
             for(size_t j = 1; (j<Fra._den.size()) && (j<=i); ++j) {
                 _dom.maxpyin(Tay[i],Fra._den[j],Tay[i-j]);
             }
             _dom.divin(Tay[i], Fra._den.front());
         }
-        for( ; (order>=i); ++i) {
+        for( ; (order>=(long)i); ++i) {
             _dom.assign(Tay[i], _dom.zero);
             for(size_t j = 1; (j<Fra._den.size()) && (j<=i); ++j) {
                 _dom.maxpyin(Tay[i],Fra._den[j],Tay[i-j]);
@@ -94,8 +94,8 @@ struct HighOrder {
 	  Degree dA; _poldom.degree(dA, FraDen);
 	  Polynomial Rev; _poldom.init(Rev,dA);
 	  for(int i=0;i<dA.value();++i)
-            _dom.div(Rev[i],(FraDen)[dA.value()-i],FraDen.front());
-          _dom.assign(Rev[dA.value()],_dom.one);
+            _dom.div(Rev[(size_t)i],(FraDen)[(size_t)dA.value()-(size_t)i],FraDen.front());
+          _dom.assign(Rev[(size_t)dA.value()],_dom.one);
           return FiducciaReversed(F, Tay, Rev, a, b);
     }
 
@@ -116,7 +116,7 @@ struct HighOrder {
 
         _dom.assign(dp,_dom.zero);
         for(long i=0;i<=dl.value();++i)
-            _dom.axpyin(dp, P[i], Q[i+shift]);
+            _dom.axpyin(dp, P[(size_t)i], Q[(size_t)(i+shift)]);
 
         return dp;
     }
@@ -143,17 +143,17 @@ struct HighOrder {
           long iterR=0;
 
           for( ; iterT < dT.value(); ++iterR,++iterT)
-              _dom.assign(Res[iterR],Tay[iterT]);
+              _dom.assign(Res[(size_t)iterR],Tay[(size_t)iterT]);
 
 	  dom_power(Xl, Xone, iterT-bonus, Qdom);
 
  	  Degree dl; _poldom.degree(dl, Xl);
-          shifteddotproduct( Res[iterR], Xl, Tay, bonus);
+          shifteddotproduct( Res[(size_t)iterR], Xl, Tay, bonus);
 
 
           for( ++iterR; iterR<=dR.value(); ++iterR) {
               Qdom.mulin(Xl, Xone);
-              shifteddotproduct( Res[iterR], Xl, Tay, bonus);
+              shifteddotproduct( Res[(size_t)iterR], Xl, Tay, bonus);
           }
 	  _truncdom.assign(F, Res);
           return _truncdom.mulin(F, a);
@@ -269,7 +269,7 @@ struct HighOrder {
         ++e; // 2^{e-2} < d <= 2^{e-1}
         int dt = int (1UL<<e);
 
-        Degree k0 = 1UL<<e;
+        Degree k0 = 1L<<e;
         Deg.push_back(k0-dA);
 
         Degree dif = order-a;
@@ -306,10 +306,10 @@ struct HighOrder {
 // write(std::cout << "T" << e << ":=", T0) << ';' << std::endl;
 
         Truncated TA; _truncdom.assign(TA, A);
-        size_t ordero2 = order.value()/2;
+        size_t ordero2 = (size_t)order.value()/2;
 
 
-        for( ; k0<ordero2; ) {
+        for( ; k0<(long)ordero2; ) {
 #ifdef GIVARO_HIGHORDER_TIMER
         Timer GivHOTimer; GivHOTimer.clear(); GivHOTimer.start();
 #endif
diff --git a/src/library/tools/givquotientdomain.h b/src/library/tools/givquotientdomain.h
index 1d6cc42..fc88d60 100644
--- a/src/library/tools/givquotientdomain.h
+++ b/src/library/tools/givquotientdomain.h
@@ -169,7 +169,7 @@ public :
 	// -- W <-- P^n
 	Rep& pow( Rep& W, const Rep& P, long n) const
 	{
-		unsigned long l = GIVABS(n);
+		unsigned long l = (unsigned long)GIVABS(n);
 		if (n>0)
 			return dom_power(W, P, l, *this);
 		else {
diff --git a/src/library/tools/givtruncdomain.h b/src/library/tools/givtruncdomain.h
index 7d432f7..21d58e3 100644
--- a/src/library/tools/givtruncdomain.h
+++ b/src/library/tools/givtruncdomain.h
@@ -13,7 +13,9 @@
 #ifndef __GIVARO_trunc_domain_H
 #define __GIVARO_trunc_domain_H
 #include <givaro/givpoly1dense.h>
+#ifndef __PATHCC__
 #include <bits/stl_pair.h>
+#endif
 
 
 namespace Givaro {
@@ -34,19 +36,22 @@ public :
 	typedef          Storage_t                Element;
 
 
-	Storage_t zero, one;
+	Storage_t zero, one,mOne;
 
 	TruncDom (const Domain& d, const Indeter& X = Indeter() ) : Father_t(d,X) {
 		this->assign(zero,Father_t::zero);
 		this->assign(one,Father_t::one);
+		this->assign(mOne,Father_t::mOne);
 	}
 	TruncDom (const Self_t& t) : Father_t(static_cast<const Father_t&>(t)) {
 		this->assign(zero,Father_t::zero);
 		this->assign(one,Father_t::one);
+		this->assign(mOne,Father_t::mOne);
 	}
 	TruncDom (const Father_t& t) : Father_t(t) {
 		this->assign(zero,Father_t::zero);
 		this->assign(one,Father_t::one);
+		this->assign(mOne,Father_t::mOne);
 	}
 
     	const Father_t& getpoldomain() const
@@ -226,7 +231,7 @@ public :
 	{
 		Degree vP; val(vP, P);
 		if (vP > d) {
-			P.first.insert(P.first.begin(),value(vP-d),this->_domain.zero);
+			P.first.insert(P.first.begin(),(size_t)value(vP-d),this->_domain.zero);
 			P.second = d;
 		}
 		return P;
@@ -379,7 +384,7 @@ public :
 	Rep& random(GivRandom& g, Rep& r, Degree s) const
 	{
 		Father_t::random(g,r.first,s);
-		r.second = g() % ((s.value()<<1)|1);
+		r.second = (Degree)(long)((unsigned long)g() % (unsigned long)((s.value()<<1)|1));
 		return r;
 	}
 	// -- Random dense polynomial with same size as b.
diff --git a/src/library/tools/givtruncdomain.inl b/src/library/tools/givtruncdomain.inl
index 8335e33..b0dd601 100644
--- a/src/library/tools/givtruncdomain.inl
+++ b/src/library/tools/givtruncdomain.inl
@@ -28,8 +28,8 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::truncin(Rep& p, const D
             p.second = 0;
             dP=Degree::deginfty;
         } else {
-            size_t diVV=value(v-vP);
-            p.first.erase(p.first.begin(),p.first.begin()+diVV);
+            size_t diVV=(size_t)value(v-vP);
+            p.first.erase(p.first.begin(),p.first.begin()+(ssize_t)diVV);
             p.second = v;
         }
         vP=v;
@@ -39,7 +39,7 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::truncin(Rep& p, const D
             p.first.reallocate(0);
             p.second = 0;
         } else {
-            p.first.resize(value(d-vP)+1);
+            p.first.resize((size_t)value(d-vP)+1);
         }
     }
     return p;
@@ -59,7 +59,7 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
     if (vR > vP) {
         expand(R, vP);
         sR = R.first.size();
-        size_t diRP = value(vR-vP);
+        size_t diRP = (size_t)value(vR-vP);
         size_t i=0;
         for( ; (i<diRP) && (i<sP); ++i)
             this->_domain.assign(R.first[i],P.first[i]);
@@ -74,7 +74,7 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                 this->_domain.addin(R.first[i], P.first[i]);
         }
     } else {
-        size_t diRP = value(vP-vR);
+        size_t diRP = (size_t)value(vP-vR);
         size_t newS = sP+diRP;
         if (newS>sR) R.first.resize(newS);
         size_t i = diRP, j=0;
@@ -104,13 +104,13 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                     expand(R, vP);
                         // v < vP = vR
                     sR = R.first.size();
-                    size_t diDV=value(d-vP)+1;
+                    size_t diDV=(size_t)value(d-vP)+1;
                     sR = (sR>diDV?diDV:sR);
                     R.first.resize(sR);
-                    size_t diDVP=value(d-vP)+1;
+                    size_t diDVP=(size_t)value(d-vP)+1;
                     sP=(sP>diDVP?diDVP:sP);
                     size_t i=0;
-                    size_t diRP = value(vR-vP);
+                    size_t diRP = (size_t)value(vR-vP);
                     if (sR < sP) R.first.resize(sP);
                     for( ; (i<diRP) && (i<sP); ++i)
                         this->_domain.assign(R.first[i],P.first[i]);
@@ -134,15 +134,15 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                     }
                         // v = vR <= vP <= d
                     long diRP = value(vP-vR);
-                    size_t diDV=value(d-vP)+1;
+                    size_t diDV=(size_t)value(d-vP)+1;
                     sP=(sP>diDV?diDV:sP);
-                    long newS = sP+diRP;
-                    long newsR = R.first.size();
+                    long newS = (long)(sP)+diRP;
+                    long newsR = (long) R.first.size();
                     Degree dR(vR+newsR-1);
                     newsR = (dR>d?value(d-vR)+1:newsR);
                     newS = (newsR>newS?newsR:newS);
-                    R.first.resize(newS);
-                    size_t i = diRP, j=0;
+                    R.first.resize((size_t)newS);
+                    size_t i = (size_t)diRP, j=0;
                     for( ; (i<sR) && (j<sP); ++i, ++j)
                         this->_domain.addin(R.first[i], P.first[j]);
                     for( ; (j<sP); ++i,++j)
@@ -154,20 +154,20 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                         // vP < vR   &&   vP < v
                     if (vR < v) {
                             // vP < vR < v
-                        Degree lastR(vR+sR-1);
+                        Degree lastR(vR+(long)sR-1);
                         if (lastR < v) {
                                 // vP <= vR < lastR < v
-                            Degree lastP(vP+sP-1);
+                            Degree lastP(vP+(long)sP-1);
                             if (lastP<v) {
                                 R.first.reallocate(0);
                                 R.second = 0;
                             } else {
                                     // vP < vR < lastR < v <= lastP
                                 lastP=(lastP>d?d:lastP);
-                                R.first.resize(value(lastP-v)+1);
+                                R.first.resize((size_t)value(lastP-v)+1);
                                 R.second = v;
                                 size_t i=0;
-                                size_t j=value(v-vP);
+                                size_t j=(size_t)value(v-vP);
                                 for( ;(j<sP) && (i<R.first.size());++i,++j)
                                     this->_domain.assign(R.first[i],P.first[j]);
                             }
@@ -178,15 +178,15 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                             R.second = v;
                             sR=R.first.size();
                             size_t i = 0;
-                            size_t j = value(v-vP);
-                            Degree lastP(vP+sP-1);
+                            size_t j = (size_t)value(v-vP);
+                            Degree lastP(vP+(long)sP-1);
                             lastP = (lastP>d?d:lastP);
-                            Degree lastRR(v+sR-1);
+                            Degree lastRR(v+(long)sR-1);
                             lastRR = (lastRR>d?d:lastRR);
-                            size_t endi=value(lastRR-v)+1;
-                            size_t endj=value(lastP-vP)+1;
+                            size_t endi=(size_t)value(lastRR-v)+1;
+                            size_t endj=(size_t)value(lastP-vP)+1;
                             lastRR = (lastP>lastRR?lastP:lastRR);
-                            R.first.resize(value(lastRR-v)+1);
+                            R.first.resize((size_t)value(lastRR-v)+1);
                             for( ; (j<endj) && (i<endi); ++i,++j)
                                 this->_domain.addin(R.first[i], P.first[j]);
                             for( ; j<endj; ++i,++j)
@@ -194,21 +194,21 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                         }
                     } else {
                             // vP < v <= vR <= d
-                        if ((vP+sP-1)<v) {
-                            size_t diRD = value(d-vR)+1;
+                        if ((vP+(long)sP-1)<v) {
+                            size_t diRD = (size_t)value(d-vR)+1;
                             if (diRD<sR) R.first.resize(diRD);
                         } else {
                             expand(R, v);
                                 // vP < v = vR
                             sR = R.first.size();
-                            size_t diDV=value(d-v)+1;
+                            size_t diDV=(size_t)value(d-v)+1;
                             sR = (sR>diDV?diDV:sR);
                             R.first.resize(sR);
-                            size_t diDVP=value(d-vP)+1;
+                            size_t diDVP=(size_t)value(d-vP)+1;
                             sP=(sP>diDVP?diDVP:sP);
-                            size_t diRP = value(vR-v);
+                            size_t diRP = (size_t)value(vR-v);
                             size_t i=0;
-                            size_t j=value(v-vP);
+                            size_t j=(size_t)value(v-vP);
                             if (sR < (sP-j)) R.first.resize(sP-j);
                             for( ; (i<diRP) && (j<sP); ++i,++j)
                                 this->_domain.assign(R.first[i],P.first[j]);
@@ -220,20 +220,20 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                     }
                 } else {
                         // vR <= vP < v <= d
-                    Degree lastR(vR+sR-1);
+                    Degree lastR(vR+(long)sR-1);
                     if (lastR < v) {
                             // vR <= vP < lastR < v
-                        Degree lastP(vP+sP-1);
+                        Degree lastP(vP+(long)sP-1);
                         if (lastP<v) {
                             R.first.reallocate(0);
                             R.second = 0;
                         } else {
                                 // vR <= vP < lastR < v <= lastP
                             lastP=(lastP>d?d:lastP);
-                            R.first.resize(value(lastP-v)+1);
+                            R.first.resize((size_t)value(lastP-v)+1);
                             R.second = v;
                             size_t i=0;
-                            size_t j=value(v-vP);
+                            size_t j=(size_t)value(v-vP);
                             for( ;(j<sP) && (i<R.first.size());++i,++j)
                                 this->_domain.assign(R.first[i],P.first[j]);
                         }
@@ -243,15 +243,15 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                         R.second = v;
                         sR=R.first.size();
                         size_t i = 0;
-                        size_t j = value(v-vP);
-                        Degree lastP(vP+sP-1);
+                        size_t j = (size_t)value(v-vP);
+                        Degree lastP(vP+(long)sP-1);
                         lastP = (lastP>d?d:lastP);
-                        Degree lastRR(v+sR-1);
+                        Degree lastRR(v+(long)sR-1);
                         lastRR = (lastRR>d?d:lastRR);
-                        size_t endi=value(lastRR-v)+1;
-                        size_t endj=value(lastP-vP)+1;
+                        size_t endi=(size_t)value(lastRR-v)+1;
+                        size_t endj=(size_t)value(lastP-vP)+1;
                         lastRR=(lastP>lastRR?lastP:lastRR);
-                        R.first.resize(value(lastRR-v)+1);
+                        R.first.resize((size_t)value(lastRR-v)+1);
                         for( ; (j<endj) && (i<endi); ++i,++j)
                             this->_domain.addin(R.first[i], P.first[j]);
                         for( ; j<endj; ++i,++j)
@@ -263,17 +263,17 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                 // vP <= d < vR
             size_t j=0;
             if (vP<v) {
-                size_t diPV = value(v-vP)+1;
+                size_t diPV = (size_t)value(v-vP)+1;
                 if (sP<diPV) {
                     R.first.resize(0);
                     R.second = 0;
                     return R;
                 }
-                j+=value(v-vP);
+                j+=(size_t)value(v-vP);
                 vP=v;
             }
             size_t i=0;
-            sR=value(d-vP)+1;
+            sR=(size_t)value(d-vP)+1;
             size_t inP = sP-j;
             sR=(inP>sR?sR:inP);
             R.first.resize(sR);
@@ -292,13 +292,13 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::addin ( Rep& R, const R
                 if (static_cast<size_t>(value(v-vR))<sR) {
                     R.first.erase(R.first.begin(),R.first.begin()+value(v-vR));
                     R.second = v;
-                    R.first.resize(value(d-v)+1);
+                    R.first.resize((size_t)value(d-v)+1);
                 } else {
                     R.first.reallocate(0);
                     R.second = 0;
                 }
             } else {
-                R.first.resize(value(d-vR)+1);
+                R.first.resize((size_t)value(d-vR)+1);
             }
         }
     }
@@ -316,7 +316,7 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::subin ( Rep& R, const R
     if (vR > vP) {
         expand(R, vP);
         sR = R.first.size();
-        size_t diRP = value(vR-vP);
+        size_t diRP = (size_t)value(vR-vP);
         size_t i=0;
         for( ; (i<diRP) && (i<sP); ++i)
             this->_domain.neg(R.first[i],P.first[i]);
@@ -331,7 +331,7 @@ inline typename TruncDom<Domain>::Rep& TruncDom<Domain>::subin ( Rep& R, const R
                 this->_domain.subin(R.first[i], P.first[i]);
         }
     } else {
-        size_t diRP = value(vP-vR);
+        size_t diRP = (size_t)value(vP-vR);
         size_t newS = sP+diRP;
         if (newS>sR) R.first.resize(newS);
         size_t i = diRP, j=0;
diff --git a/src/library/vector/Makefile.in b/src/library/vector/Makefile.in
index 243aee7..ad6589a 100644
--- a/src/library/vector/Makefile.in
+++ b/src/library/vector/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -22,9 +22,27 @@
 # see the COPYRIGHT file for more details.
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -58,18 +76,44 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 depcomp =
 am__depfiles_maybe =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     *) f=$$p;; \
   esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
-pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -103,6 +147,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -138,6 +183,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -225,9 +271,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps src/library/vector/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps src/library/vector/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/library/vector/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps src/library/vector/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -245,6 +291,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -253,21 +300,25 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
 	done
 
 uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(pkginclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
-	done
+	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -281,7 +332,7 @@ tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -289,29 +340,34 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -332,13 +388,17 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
@@ -359,16 +419,22 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -454,6 +520,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/library/vector/givstorage.h b/src/library/vector/givstorage.h
index c70d9c6..1ace6c7 100644
--- a/src/library/vector/givstorage.h
+++ b/src/library/vector/givstorage.h
@@ -14,7 +14,7 @@
 
 #include "givaro/givcategory.h"
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 // ==========================================================================
diff --git a/src/library/vector/givstoragedense.h b/src/library/vector/givstoragedense.h
index 6d71d1a..48aba3a 100644
--- a/src/library/vector/givstoragedense.h
+++ b/src/library/vector/givstoragedense.h
@@ -15,7 +15,7 @@
 #include "givaro/givstorage.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 // ==========================================================================
 // --
diff --git a/src/library/vector/givvectdenseops.inl b/src/library/vector/givvectdenseops.inl
index 9f3863b..debef2d 100644
--- a/src/library/vector/givvectdenseops.inl
+++ b/src/library/vector/givvectdenseops.inl
@@ -9,7 +9,7 @@
 // $Id
 // ==========================================================================
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
   // -- map of a unary operator, with operator()( Type_t& res )
diff --git a/src/library/vector/givvectdensespe.inl b/src/library/vector/givvectdensespe.inl
index 8b833b1..fb08546 100644
--- a/src/library/vector/givvectdensespe.inl
+++ b/src/library/vector/givvectdensespe.inl
@@ -9,7 +9,7 @@
 // $Id
 // ==========================================================================
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 
diff --git a/src/library/vector/givvector.h b/src/library/vector/givvector.h
index 268bd79..0efcacf 100644
--- a/src/library/vector/givvector.h
+++ b/src/library/vector/givvector.h
@@ -23,7 +23,7 @@
 #include "givaro/givops.h"
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 
diff --git a/src/library/vector/givvectordense.inl b/src/library/vector/givvectordense.inl
index b7f2c30..dc0014a 100644
--- a/src/library/vector/givvectordense.inl
+++ b/src/library/vector/givvectordense.inl
@@ -10,7 +10,7 @@
 // ==========================================================================
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 }// Givaro
diff --git a/src/library/vector/givvectorsparse.h b/src/library/vector/givvectorsparse.h
index 5b9a993..7fca3e3 100644
--- a/src/library/vector/givvectorsparse.h
+++ b/src/library/vector/givvectorsparse.h
@@ -23,7 +23,7 @@
 #include "givaro/givstoragesparse.h"
 #include "givaro/givelem.h"
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 
diff --git a/src/library/vector/givvectorsparse.inl b/src/library/vector/givvectorsparse.inl
index 5d03db6..434e555 100644
--- a/src/library/vector/givvectorsparse.inl
+++ b/src/library/vector/givvectorsparse.inl
@@ -10,7 +10,7 @@
 // ==========================================================================
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 } //Givaro
 
diff --git a/src/library/vector/givvectsparseops.inl b/src/library/vector/givvectsparseops.inl
index 24a8c7f..d6c01b0 100644
--- a/src/library/vector/givvectsparseops.inl
+++ b/src/library/vector/givvectsparseops.inl
@@ -10,7 +10,7 @@
 // ==========================================================================
 
 namespace Givaro {
-#warning "this file will probably not compile"
+#pragma message "#warning this file will probably not compile"
 
 
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9b86bfd..0e42f92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,7 +12,7 @@ AM_CXXFLAGS = @TESTS_CFLAGS@
 AM_CPPFLAGS += $(OPTFLAGS) $(GMP_CFLAGS) -I$(top_srcdir)/src/kernel/system -I$(top_srcdir)/src/kernel/memory -I$(top_srcdir)/src/kernel/zpz -I$(top_srcdir)/src/kernel/integer -I$(top_srcdir)/src/kernel -I$(top_srcdir)/src/library/poly1 -I$(top_srcdir)/src/kernel/bstruct -I$(top_srcdir)/src/library/tools
 
 LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
-AM_LDFLAGS=-static
+AM_LDFLAGS=-static $(LDFLAGS)
 
 BASIC_TESTS =          \
 		test-random    \
@@ -25,7 +25,8 @@ BASIC_TESTS =          \
 		test-crt       \
 		test-geom      \
 		test-integer   \
-        test-ratrecon
+		test-conversion \
+		test-ratrecon
 
 CLEANFILES =           \
 		$(BASIC_TESTS)
@@ -48,6 +49,7 @@ test_crt_SOURCES      = test-crt.C
 test_geom_SOURCES     = test-geom.C
 test_integer_SOURCES  = test-integer.C
 test_ratrecon_SOURCES = test-ratrecon.C
+test_conversion_SOURCES = test-conversion.C
 
 
 # for compilation of new tests
diff --git a/tests/Makefile.in b/tests/Makefile.in
index f488245..af7831a 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.10.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,9 +21,27 @@
 # and abiding by the rules of distribution of free software.
 # see the COPYRIGHT file for more details.
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
@@ -58,15 +76,20 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
 am__EXEEXT_1 = test-random$(EXEEXT) test-ifactor$(EXEEXT) \
 	test-ffarith$(EXEEXT) test-ringarith$(EXEEXT) \
 	test-mod$(EXEEXT) test-modsqroot$(EXEEXT) test-trunc$(EXEEXT) \
 	test-crt$(EXEEXT) test-geom$(EXEEXT) test-integer$(EXEEXT) \
-	test-ratrecon$(EXEEXT)
+	test-conversion$(EXEEXT) test-ratrecon$(EXEEXT)
+am_test_conversion_OBJECTS = test-conversion.$(OBJEXT)
+test_conversion_OBJECTS = $(am_test_conversion_OBJECTS)
+test_conversion_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+test_conversion_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_test_crt_OBJECTS = test-crt.$(OBJEXT)
 test_crt_OBJECTS = $(am_test_crt_OBJECTS)
 test_crt_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
 test_crt_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_test_ffarith_OBJECTS = test-ffarith.$(OBJEXT)
 test_ffarith_OBJECTS = $(am_test_ffarith_OBJECTS)
@@ -120,18 +143,18 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(test_crt_SOURCES) $(test_ffarith_SOURCES) \
-	$(test_geom_SOURCES) $(test_ifactor_SOURCES) \
-	$(test_integer_SOURCES) $(test_mod_SOURCES) \
-	$(test_modsqroot_SOURCES) $(test_random_SOURCES) \
-	$(test_ratrecon_SOURCES) $(test_ringarith_SOURCES) \
-	$(test_trunc_SOURCES)
-DIST_SOURCES = $(test_crt_SOURCES) $(test_ffarith_SOURCES) \
-	$(test_geom_SOURCES) $(test_ifactor_SOURCES) \
-	$(test_integer_SOURCES) $(test_mod_SOURCES) \
-	$(test_modsqroot_SOURCES) $(test_random_SOURCES) \
-	$(test_ratrecon_SOURCES) $(test_ringarith_SOURCES) \
-	$(test_trunc_SOURCES)
+SOURCES = $(test_conversion_SOURCES) $(test_crt_SOURCES) \
+	$(test_ffarith_SOURCES) $(test_geom_SOURCES) \
+	$(test_ifactor_SOURCES) $(test_integer_SOURCES) \
+	$(test_mod_SOURCES) $(test_modsqroot_SOURCES) \
+	$(test_random_SOURCES) $(test_ratrecon_SOURCES) \
+	$(test_ringarith_SOURCES) $(test_trunc_SOURCES)
+DIST_SOURCES = $(test_conversion_SOURCES) $(test_crt_SOURCES) \
+	$(test_ffarith_SOURCES) $(test_geom_SOURCES) \
+	$(test_ifactor_SOURCES) $(test_integer_SOURCES) \
+	$(test_mod_SOURCES) $(test_modsqroot_SOURCES) \
+	$(test_random_SOURCES) $(test_ratrecon_SOURCES) \
+	$(test_ringarith_SOURCES) $(test_trunc_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -139,12 +162,47 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
 ETAGS = etags
 CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -174,6 +232,7 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GIVARO_DOC_PATH = @GIVARO_DOC_PATH@
+GIVARO_INLINE_ALL = @GIVARO_INLINE_ALL@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
@@ -209,6 +268,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PROF = @PROF@
 RANLIB = @RANLIB@
 RM = @RM@
 SED = @SED@
@@ -280,7 +340,7 @@ AM_CPPFLAGS = -I$(top_srcdir) $(OPTFLAGS) $(GMP_CFLAGS) \
 	-I$(top_srcdir)/src/library/tools
 AM_CXXFLAGS = @TESTS_CFLAGS@
 LDADD = $(OPTLINKS) -L${top_srcdir}/src -L${top_srcdir}/src/.libs -lgivaro $(GMP_LIBS)
-AM_LDFLAGS = -static
+AM_LDFLAGS = -static $(LDFLAGS)
 BASIC_TESTS = \
 		test-random    \
 		test-ifactor   \
@@ -292,7 +352,8 @@ BASIC_TESTS = \
 		test-crt       \
 		test-geom      \
 		test-integer   \
-        test-ratrecon
+		test-conversion \
+		test-ratrecon
 
 CLEANFILES = \
 		$(BASIC_TESTS)
@@ -308,6 +369,7 @@ test_crt_SOURCES = test-crt.C
 test_geom_SOURCES = test-geom.C
 test_integer_SOURCES = test-integer.C
 test_ratrecon_SOURCES = test-ratrecon.C
+test_conversion_SOURCES = test-conversion.C
 
 # for compilation of new tests
 GIVARO_BIN = @bindir@
@@ -324,9 +386,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps tests/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps tests/Makefile
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu --ignore-deps tests/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -344,37 +406,41 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-test-crt$(EXEEXT): $(test_crt_OBJECTS) $(test_crt_DEPENDENCIES) 
+$(am__aclocal_m4_deps):
+test-conversion$(EXEEXT): $(test_conversion_OBJECTS) $(test_conversion_DEPENDENCIES) $(EXTRA_test_conversion_DEPENDENCIES) 
+	@rm -f test-conversion$(EXEEXT)
+	$(CXXLINK) $(test_conversion_OBJECTS) $(test_conversion_LDADD) $(LIBS)
+test-crt$(EXEEXT): $(test_crt_OBJECTS) $(test_crt_DEPENDENCIES) $(EXTRA_test_crt_DEPENDENCIES) 
 	@rm -f test-crt$(EXEEXT)
 	$(CXXLINK) $(test_crt_OBJECTS) $(test_crt_LDADD) $(LIBS)
-test-ffarith$(EXEEXT): $(test_ffarith_OBJECTS) $(test_ffarith_DEPENDENCIES) 
+test-ffarith$(EXEEXT): $(test_ffarith_OBJECTS) $(test_ffarith_DEPENDENCIES) $(EXTRA_test_ffarith_DEPENDENCIES) 
 	@rm -f test-ffarith$(EXEEXT)
 	$(CXXLINK) $(test_ffarith_OBJECTS) $(test_ffarith_LDADD) $(LIBS)
-test-geom$(EXEEXT): $(test_geom_OBJECTS) $(test_geom_DEPENDENCIES) 
+test-geom$(EXEEXT): $(test_geom_OBJECTS) $(test_geom_DEPENDENCIES) $(EXTRA_test_geom_DEPENDENCIES) 
 	@rm -f test-geom$(EXEEXT)
 	$(CXXLINK) $(test_geom_OBJECTS) $(test_geom_LDADD) $(LIBS)
-test-ifactor$(EXEEXT): $(test_ifactor_OBJECTS) $(test_ifactor_DEPENDENCIES) 
+test-ifactor$(EXEEXT): $(test_ifactor_OBJECTS) $(test_ifactor_DEPENDENCIES) $(EXTRA_test_ifactor_DEPENDENCIES) 
 	@rm -f test-ifactor$(EXEEXT)
 	$(CXXLINK) $(test_ifactor_OBJECTS) $(test_ifactor_LDADD) $(LIBS)
-test-integer$(EXEEXT): $(test_integer_OBJECTS) $(test_integer_DEPENDENCIES) 
+test-integer$(EXEEXT): $(test_integer_OBJECTS) $(test_integer_DEPENDENCIES) $(EXTRA_test_integer_DEPENDENCIES) 
 	@rm -f test-integer$(EXEEXT)
 	$(CXXLINK) $(test_integer_OBJECTS) $(test_integer_LDADD) $(LIBS)
-test-mod$(EXEEXT): $(test_mod_OBJECTS) $(test_mod_DEPENDENCIES) 
+test-mod$(EXEEXT): $(test_mod_OBJECTS) $(test_mod_DEPENDENCIES) $(EXTRA_test_mod_DEPENDENCIES) 
 	@rm -f test-mod$(EXEEXT)
 	$(CXXLINK) $(test_mod_OBJECTS) $(test_mod_LDADD) $(LIBS)
-test-modsqroot$(EXEEXT): $(test_modsqroot_OBJECTS) $(test_modsqroot_DEPENDENCIES) 
+test-modsqroot$(EXEEXT): $(test_modsqroot_OBJECTS) $(test_modsqroot_DEPENDENCIES) $(EXTRA_test_modsqroot_DEPENDENCIES) 
 	@rm -f test-modsqroot$(EXEEXT)
 	$(CXXLINK) $(test_modsqroot_OBJECTS) $(test_modsqroot_LDADD) $(LIBS)
-test-random$(EXEEXT): $(test_random_OBJECTS) $(test_random_DEPENDENCIES) 
+test-random$(EXEEXT): $(test_random_OBJECTS) $(test_random_DEPENDENCIES) $(EXTRA_test_random_DEPENDENCIES) 
 	@rm -f test-random$(EXEEXT)
 	$(CXXLINK) $(test_random_OBJECTS) $(test_random_LDADD) $(LIBS)
-test-ratrecon$(EXEEXT): $(test_ratrecon_OBJECTS) $(test_ratrecon_DEPENDENCIES) 
+test-ratrecon$(EXEEXT): $(test_ratrecon_OBJECTS) $(test_ratrecon_DEPENDENCIES) $(EXTRA_test_ratrecon_DEPENDENCIES) 
 	@rm -f test-ratrecon$(EXEEXT)
 	$(CXXLINK) $(test_ratrecon_OBJECTS) $(test_ratrecon_LDADD) $(LIBS)
-test-ringarith$(EXEEXT): $(test_ringarith_OBJECTS) $(test_ringarith_DEPENDENCIES) 
+test-ringarith$(EXEEXT): $(test_ringarith_OBJECTS) $(test_ringarith_DEPENDENCIES) $(EXTRA_test_ringarith_DEPENDENCIES) 
 	@rm -f test-ringarith$(EXEEXT)
 	$(CXXLINK) $(test_ringarith_OBJECTS) $(test_ringarith_LDADD) $(LIBS)
-test-trunc$(EXEEXT): $(test_trunc_OBJECTS) $(test_trunc_DEPENDENCIES) 
+test-trunc$(EXEEXT): $(test_trunc_OBJECTS) $(test_trunc_DEPENDENCIES) $(EXTRA_test_trunc_DEPENDENCIES) 
 	@rm -f test-trunc$(EXEEXT)
 	$(CXXLINK) $(test_trunc_OBJECTS) $(test_trunc_LDADD) $(LIBS)
 
@@ -423,7 +489,7 @@ $(RECURSIVE_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
@@ -457,16 +523,16 @@ $(RECURSIVE_CLEAN_TARGETS):
 	  else \
 	    local_target="$$target"; \
 	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
 	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
 	done
 ctags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -481,7 +547,7 @@ tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
+	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
@@ -493,7 +559,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
@@ -502,29 +568,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
 	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	tags=; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
+	     $$unique
 
 GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -533,6 +604,7 @@ check-TESTS: $(TESTS)
 	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
 	srcdir=$(srcdir); export srcdir; \
 	list=' $(TESTS) '; \
+	$(am__tty_colors); \
 	if test -n "$$list"; then \
 	  for tst in $$list; do \
 	    if test -f ./$$tst; then dir=./; \
@@ -544,10 +616,10 @@ check-TESTS: $(TESTS)
 	      *[\ \	]$$tst[\ \	]*) \
 		xpass=`expr $$xpass + 1`; \
 		failed=`expr $$failed + 1`; \
-		echo "XPASS: $$tst"; \
+		col=$$red; res=XPASS; \
 	      ;; \
 	      *) \
-		echo "PASS: $$tst"; \
+		col=$$grn; res=PASS; \
 	      ;; \
 	      esac; \
 	    elif test $$? -ne 77; then \
@@ -555,17 +627,18 @@ check-TESTS: $(TESTS)
 	      case " $(XFAIL_TESTS) " in \
 	      *[\ \	]$$tst[\ \	]*) \
 		xfail=`expr $$xfail + 1`; \
-		echo "XFAIL: $$tst"; \
+		col=$$lgn; res=XFAIL; \
 	      ;; \
 	      *) \
 		failed=`expr $$failed + 1`; \
-		echo "FAIL: $$tst"; \
+		col=$$red; res=FAIL; \
 	      ;; \
 	      esac; \
 	    else \
 	      skip=`expr $$skip + 1`; \
-	      echo "SKIP: $$tst"; \
+	      col=$$blu; res=SKIP; \
 	    fi; \
+	    echo "$${col}$$res$${std}: $$tst"; \
 	  done; \
 	  if test "$$all" -eq 1; then \
 	    tests="test"; \
@@ -607,11 +680,16 @@ check-TESTS: $(TESTS)
 	      dashes="$$report"; \
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
-	  echo "$$dashes"; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes"; \
+	  if test "$$failed" -eq 0; then \
+	    col="$$grn"; \
+	  else \
+	    col="$$red"; \
+	  fi; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -631,29 +709,41 @@ distdir: $(DISTFILES)
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 	  if test -d $$d/$$file; then \
 	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
 	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
 	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
 		am__remove_distdir=: \
 		am__skip_length_check=: \
+		am__skip_mode_fix=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -674,10 +764,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -685,6 +780,7 @@ clean-generic:
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -757,8 +853,8 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
+	ctags-recursive install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-TESTS check-am clean clean-generic \
@@ -778,6 +874,7 @@ uninstall-am:
 check: $(BASE_TESTS)
 %:%.C
 	$(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs`
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/tests/test-conversion.C b/tests/test-conversion.C
new file mode 100644
index 0000000..35a1065
--- /dev/null
+++ b/tests/test-conversion.C
@@ -0,0 +1,88 @@
+// Copyright(c)'2011 by The Givaro group
+// This file is part of Givaro.
+// written by BB
+// Givaro is governed by the CeCILL-B license under French law
+// and abiding by the rules of distribution of free software.
+// see the COPYRIGHT file for more details.
+
+
+#include <givaro/givinteger.h>
+#include <math.h>
+
+using namespace Givaro;
+
+int testBasicConversion()
+{
+	int err = 0;
+	/* test small neg int */
+	const int qq = -1 ;
+	const Integer q(qq);
+	int q1  = (int) q;
+	if (q1 != qq)
+		return err = 1;
+
+	long int q2 = (long int) q;
+	if (q2 != qq)
+		return err = 2;
+
+#ifndef __GIVARO__DONOTUSE_longlong__
+	long long int q3 = (long long int) q;
+	if (q3 != qq)
+		return err = 3 ;
+#endif
+
+	/*  test unsigned versions */
+	/*  cast towards unsigned consider only the absolute value */
+	unsigned int uqq = (unsigned int) qq;
+	unsigned int q4  = (unsigned int) (int) q;
+// 	std::cout << q4 << std::endl;
+// 	std::cout << uqq << std::endl;
+	if (q4 != uqq)
+		return err = 4;
+
+	unsigned long lqq = (unsigned long) qq;
+//         std::cerr << "q  : " << q << std::endl;
+	unsigned long int q5 = (unsigned long) (long int) q;
+//         std::cerr << "lqq: " << lqq << std::endl;
+//         std::cerr << "q5 : " << q5 << std::endl;
+	if (q5 != lqq)
+		return err = 5;
+
+#ifndef __GIVARO__DONOTUSE_longlong__
+	unsigned long long luqq = (unsigned long long) qq;
+	unsigned long long int q6 = (unsigned long long) (long long int) q;
+	if (q6 != luqq)
+		return err = 6 ;
+#endif
+
+
+	/*  test unsigned versions */
+	/*  cast towards unsigned consider only the absolute value */
+	unsigned int vqq = (unsigned int) qq;
+	unsigned int q7  = (unsigned int) q;
+// 	std::cout << q7 << std::endl;
+// 	std::cout << uqq << std::endl;
+	if (q7 != -vqq)
+		return err = 7;
+
+	unsigned long int q8 = (unsigned long int) q;
+	if (q8 != -vqq)
+		return err = 8;
+
+#ifndef __GIVARO__DONOTUSE_longlong__
+	unsigned long long int q9 = (unsigned long long int) q;
+	if (q9 != -vqq)
+		return err = 9 ;
+#endif
+
+	return err ;
+
+}
+
+int main()
+{
+	int err = 0;
+	err  = testBasicConversion();
+	return err ;
+
+}
diff --git a/tests/test-crt.C b/tests/test-crt.C
index 0684364..715d9e5 100644
--- a/tests/test-crt.C
+++ b/tests/test-crt.C
@@ -45,7 +45,7 @@ Integer tmain(int argc, char ** argv, const GivRandom& generator)
 	IntPrimeDom ID;
 	Integer a( generator() >>(argc>2?atoi(argv[2]):17) ), M(1), b;
 
-	Prime_t  Primes( argc>1 ? atoi(argv[1]):15);
+	Prime_t  Primes( argc>1 ? (size_t)atoi(argv[1]):15);
 	Domains  PrimeDoms( Primes.size() );
 	Elements Moduli( Primes.size() );
 	Prime_t  ModuliInts( Primes.size() );
@@ -144,7 +144,7 @@ int main(int argc, char ** argv)
 	// argv[2] : 2^{32-j} is size of primes
 	// argv[3] : seed for generator
 
-	GivRandom seedor( argc>3 ? atoi(argv[3]): BaseTimer::seed() );
+	GivRandom seedor( argc>3 ? (unsigned)atoi(argv[3]): (unsigned)BaseTimer::seed() );
 	unsigned long seed = seedor.seed();
 
 
diff --git a/tests/test-ffarith.C b/tests/test-ffarith.C
index fc26c57..acc1d19 100644
--- a/tests/test-ffarith.C
+++ b/tests/test-ffarith.C
@@ -46,7 +46,7 @@ int TestOneField(const Field& F, const int FIRSTINT, const float FIRSTFLOAT)
 
 
 
-	typename Field::Element a, b, c, d,a_,b_,c_,d_;
+	typename Field::Element a, b, c, d,a_,b_,c_,d_,ma;
 	typename Field::Element e,e_;
 
         F.init(a, 0UL);
@@ -56,6 +56,8 @@ int TestOneField(const Field& F, const int FIRSTINT, const float FIRSTFLOAT)
 //         F.write(std::cerr << "a: ", a) << std::endl;
 //         F.write(std::cerr << "1: ", F.one) << std::endl;
         TESTE_EG(a, F.one);
+	F.init(ma,-1L);
+        TESTE_EG(ma, F.mOne);
 
 	F.init(a, FIRSTINT);
 	F.init(b, FIRSTFLOAT);
@@ -203,7 +205,7 @@ int TestOneField(const Field& F, const int FIRSTINT, const float FIRSTFLOAT)
 template<class Field>
 int TestField(const Field& F, const int seed)
 {/*{{{*/
-    long ch = F.characteristic();
+    long ch = (long) F.characteristic();
     JEONETESTE(F,7UL,-29.3);
     srand48(seed);
     for(size_t i=0; i< NBITER; ++i) {
@@ -229,7 +231,7 @@ int main(int argc, char ** argv)
 #ifdef GIVARO_DEBUG
     std::cerr << "seed: " << seed << std::endl;
 #endif
-    Integer::seeding(seed);
+    Integer::seeding((unsigned long)seed);
 
 
 #ifdef NDEBUG
@@ -346,6 +348,23 @@ int main(int argc, char ** argv)
 	ZpzDom<Integer> IntZ13(13);
 	JETESTE(IntZ13,seed);
 
+	// modulo 13 with generic implementation over signed integral type
+	ZpzDom<long long> GenZ13(13);
+	JETESTE(GenZ13,seed);
+
+	// modulo 101 with generic implementation over unsigned signed integral type
+	ZpzDom<unsigned long long> GenZ101(101);
+	JETESTE(GenZ101,seed);
+
+        // Zech log finite field with 256 elements
+        // and prescribed 1 + x +x^3 +x^4 +x^8 irreducible polynomial
+        std::vector< GFqDom<long>::Residu_t > Irred(9);
+        Irred[0] = 1; Irred[1] = 1; Irred[2] = 0; Irred[3] = 1;
+        Irred[4] = 1; Irred[5] = 0; Irred[6] = 0; Irred[7] = 0;
+        Irred[8] = 1;
+        GFqDom<long> GF256(2,8, Irred);
+        JETESTE(GF256,seed);
+
 	// Zech log finite field with 5^4 elements
 	GFqDom<int> GF625( 5, 4 );
 	JETESTE(GF625,seed);
diff --git a/tests/test-geom.C b/tests/test-geom.C
index f950ddc..fdb481e 100644
--- a/tests/test-geom.C
+++ b/tests/test-geom.C
@@ -79,7 +79,7 @@ template<class Interp, class RandIter>
 bool TestOneField(Interp& FD, RandIter& generator, size_t degmax) {
 
     typename Interp::Polynomial_t nouv, prec;
-    FD.getpoldomain().random(generator, prec, Degree(degmax) );
+    FD.getpoldomain().random(generator, prec, Degree((long)degmax) );
 
 #ifdef GIVARO_DEBUG
     FD.getpoldomain().write(std::cout << "Precedent: ", prec) << std::endl;
@@ -116,7 +116,7 @@ bool TestOneFieldVect(Interp& FD, RandIter& generator, size_t degmax, size_t num
 
     std::vector<typename Interp::Polynomial_t> nouv(numpol), prec(numpol);
     for(size_t i=0; i< numpol; ++i) {
-        FD.getpoldomain().random(generator, prec[i], Degree(degmax) );
+        FD.getpoldomain().random(generator, prec[i], Degree((long)degmax) );
 #ifdef GIVARO_DEBUG
         FD.getpoldomain().write(std::cout << "Precedent[" << i << "]: ", prec[i]) << std::endl;
 #endif
@@ -159,11 +159,11 @@ int main(int argc, char ** argv) {
         // argv[3] : num poly max
         // argv[4] : seed
 
-    GFqDom<long>::Residu_t MOD = (argc>1 ? atoi(argv[1]) : 101);
-    size_t degmax = (argc>2 ? atoi(argv[2]) : 20);
-    size_t numpolmax = (argc>3 ? atoi(argv[3]) : 15);
+    GFqDom<long>::Residu_t MOD = (argc>1 ? (GFqDom<long>::Residu_t) atoi(argv[1]) : 101);
+    size_t degmax = (argc>2 ? (size_t)atoi(argv[2]) : 20);
+    size_t numpolmax = (argc>3 ? (size_t)atoi(argv[3]) : 15);
 
-    size_t seed = (argc>4?atoi(argv[4]):BaseTimer::seed());
+    size_t seed = (argc>4?(size_t)atoi(argv[4]):(size_t)BaseTimer::seed());
 #ifdef GIVARO_DEBUG
     std::cerr << "seed: " << seed << std::endl;
 #endif
diff --git a/tests/test-integer.C b/tests/test-integer.C
index 62acc81..4750644 100644
--- a/tests/test-integer.C
+++ b/tests/test-integer.C
@@ -5,12 +5,13 @@
 // written by BB
 // see the COPYRIGHT file for more details.
 
-/*! @file tests/test-integer.h
+/*! @file tests/test-integer.C
  * @ingroup tests
  * tests integer.h fucntions not tested elsewhere.
  * @test tests integer.h fucntions not tested elsewhere.
  */
 
+#include <stdlib.h>
 #include "gmp++/gmp++.h"
 
 using namespace Givaro;
@@ -169,10 +170,95 @@ int test_mul()
 	return res ;
 }
 
+#include <typeinfo>
+#include <iostream>
+
+
+template<typename UnsignedBaseType>
+int test_cast_unit(const UnsignedBaseType& t, const Integer& a, const Integer& b) {
+#ifdef GIVARO_DEBUG
+    std::cerr << "TYPE: " << typeid(t).name() << std::endl;
+#endif
+
+    Integer it(t), iu=t, iv=Integer(t);
+
+    if ( (UnsignedBaseType)it != t) return -1;
+    if ( (UnsignedBaseType)iu != t) return -2;
+    if ( (UnsignedBaseType)iv != t) return -3;
+
+    UnsignedBaseType at( (UnsignedBaseType)a ), bt( (UnsignedBaseType) b );
+
+    if ( (UnsignedBaseType) (at * bt) != (UnsignedBaseType)(a*b) ) {
+#ifdef GIVARO_DEBUG
+        std::cerr << "a: " << a << std::endl;
+        std::cerr << "b: " << b << std::endl;
+        std::cerr << "a*b: " << (a*b) << std::endl;
+        std::cerr << "(a*b)t: " << ( (UnsignedBaseType)(a*b) ) << std::endl;
+        std::cerr << "at: " << at << std::endl;
+        std::cerr << "bt: " << bt << std::endl;
+        std::cerr << "at*bt: " << ( at * bt ) << std::endl;
+        std::cerr << "(at*bt)t: " << (UnsignedBaseType)( at * bt ) << std::endl;
+#endif
+        return -10;
+    }
+
+    return 0;
+}
+
+int test_cast_unit(const Integer& a, const Integer& b) {
+    int res = 0;
+    res = test_cast_unit( (bool) Integer::random<false>(), a, b);
+		if (res) return res ;
+    res = test_cast_unit( (unsigned short) Integer::random<false>(), a, b);
+		if (res) return res ;
+    res = test_cast_unit( (unsigned char) Integer::random<false>(), a, b);
+		if (res) return res ;
+    res = test_cast_unit( (unsigned int) Integer::random<false>(), a, b);
+		if (res) return res ;
+    res = test_cast_unit( (unsigned long) Integer::random<false>(), a, b);
+		if (res) return res ;
+
+    return 0;
+}
+
+
+int test_cast() {
+	Integer a,b ;
+	int res = 0 ;
+	int repet = _GIV_REPET ;
+	while (--repet) {
+		/* axpy */
+		a = Integer::random<false>();
+		b = Integer::random<false>();
+		res = test_cast_unit(a,b);
+		if (res) return res ;
+
+		a = 0 ;
+		res = test_cast_unit(a,b);
+		if (res) return res ;
+
+		a = Integer::random<false>();
+		b = 0 ;
+		res = test_cast_unit(a,b);
+		if (res) return res ;
+
+	}
+
+	return res ;
+}
+
+
+
 //! @todo test gcd...
 
-int main ()
+int main (int argc, char ** argv)
 {
+    unsigned long seed = (unsigned long)(argc>1?(unsigned long)atoi(argv[1]):(unsigned long)BaseTimer::seed ());
+#ifdef GIVARO_DEBUG
+    std::cerr << "Seed: " << seed << std::endl;
+#endif
+    Integer::seeding (seed);
+
 	int res = 0 ;
 	res = test_axpy();
 	if (res)
@@ -182,6 +268,10 @@ int main ()
 	if (res)
 		return res ;
 
+	res = test_cast();
+	if (res)
+		return res ;
+
 
 	return res ;
 }
diff --git a/tests/test-mod.C b/tests/test-mod.C
index 4cdb9a6..595ff10 100644
--- a/tests/test-mod.C
+++ b/tests/test-mod.C
@@ -11,9 +11,9 @@
 
 using namespace Givaro;
 
-#define SONT_EQ(a,b)\
+#define AREEQUALVALUES(a,b)\
 	if ( (a) != (b) ) { \
-		std::cout << "erreur à la ligne " << __LINE__ << std::endl; \
+		std::cout << "*** ERROR line " << __LINE__ << std::endl; \
 		std::cout << a << "!=" << b << std::endl; \
 		return -1 ; \
 	}
@@ -80,19 +80,19 @@ int test1( const T m, const U p)
 	Integer R ;
 
 	Integer::mod(R,M,P);
-	SONT_EQ(r,R);
+	AREEQUALVALUES(r,R);
 
 	Integer::mod(R,M,p);
-	SONT_EQ(r,R);
+	AREEQUALVALUES(r,R);
 
 
 	Integer R1 = M ;
 	Integer::modin(R1,P);
-	SONT_EQ(R,R1);
+	AREEQUALVALUES(R,R1);
 
 	R1 = M ;
 	Integer::modin(R1,p);
-	SONT_EQ(R,R1);
+	AREEQUALVALUES(R,R1);
 
 
 	return 0;
@@ -110,18 +110,18 @@ int test1bis( const T m, const U p)
 	Integer R =r ;
 
 	Integer R1 = M%p ;
-	SONT_EQ(R,R1);
+	AREEQUALVALUES(R,R1);
 
 	Integer R2 = M%P ;
-	SONT_EQ(R,R2);
+	AREEQUALVALUES(R,R2);
 
 	Integer R3 = M%pi ;
-	SONT_EQ(R,R3);
+	AREEQUALVALUES(R,R3);
 
 
 	R2 = M ;
 	R2 %= P ;
-	SONT_EQ(R,R2);
+	AREEQUALVALUES(R,R2);
 
 	return 0;
 }/*}}}*/
@@ -139,11 +139,11 @@ int test2(Integer & M, Integer & P)
 	//!@todo existe pas !
 	//R = Integer:: imod(M,P) ;
 	Integer:: mod(R,M,P) ;
-	SONT_EQ(RR,R);
+	AREEQUALVALUES(RR,R);
 
 	R = M ;
 	Integer::modin(R,P);
-	SONT_EQ(RR,R);
+	AREEQUALVALUES(RR,R);
 
 	return 0;
 }/*}}}*/
@@ -160,11 +160,11 @@ int test2bis(Integer & M, Integer & P)
 
 	R = M ;
 	R %= P;
-	SONT_EQ(RR,R);
+	AREEQUALVALUES(RR,R);
 
 	R = M ;
 	R = M%P;
-	SONT_EQ(RR,R);
+	AREEQUALVALUES(RR,R);
 
 	return 0;
 }/*}}}*/
@@ -173,31 +173,31 @@ template< class T, class U>
 int test3( const T m, const U p)
 {/*{{{*/
 	int pi = int(p);
-	long int q = m / p;
+	long int q = (long int)(m / (T)p);
 	const Integer M(m);
 	const Integer P(p);
 	Integer Q ;
 
 	Integer::div(Q,M,P);
-	SONT_EQ(q,Q);
+	AREEQUALVALUES(q,Q);
 
 	Integer Q1 = M/p ;
-	SONT_EQ(Q,Q1);
+	AREEQUALVALUES(Q,Q1);
 
 	Integer Q2 = M/P ;
-	SONT_EQ(Q,Q2);
+	AREEQUALVALUES(Q,Q2);
 
 	Integer Q3 = M/pi ;
-	SONT_EQ(Q,Q3);
+	AREEQUALVALUES(Q,Q3);
 
 	Q1 = M ;
 	Integer::divin(Q1,P);
-	SONT_EQ(Q,Q1);
+	AREEQUALVALUES(Q,Q1);
 
 
 	Q2 = M ;
 	Q2 /= P ;
-	SONT_EQ(Q,Q2);
+	AREEQUALVALUES(Q,Q2);
 
 	return 0;
 }/*}}}*/
@@ -213,12 +213,12 @@ int main()
 #endif
 
 	long int p = 78678675;
-	unsigned long int M(m);
-	unsigned long int P(p);
+	unsigned long int M((unsigned long)m);
+	unsigned long int P((unsigned long)p);
 
-        Integer mone(-1);
+        Integer mOne(-1);
             // CONDITION: mpz_tdiv_ui does NOT consider the sign of gmp_rep
-        assert(mpz_tdiv_ui( (mpz_ptr)&mone, 3) == 1);
+        assert(mpz_tdiv_ui( (mpz_ptr)&mOne, 3) == 1);
 
 	// Integer r ;
 	// Integer a = -6 ;
diff --git a/tests/test-modsqroot.C b/tests/test-modsqroot.C
index fb20021..ce801cb 100644
--- a/tests/test-modsqroot.C
+++ b/tests/test-modsqroot.C
@@ -8,10 +8,10 @@
 // Givaro : Modular square roots
 // =================================================================== //
 
-/*! @file examples/Integer/ModularSquareRoot.C
+/*! @file tests/test-modsqroot.C
  * @ingroup examples
  * @ingroup integers
- * @example examples/Integer/ModularSquareRoot.C
+ * @see examples/Integer/ModularSquareRoot.C
  * @brief NO DOC
  */
 #include <iostream>
@@ -43,7 +43,7 @@ bool TestSrqtMod(const Integer& z, const Integer& n) {
 int main(int argc, char** argv) {
     int nbtests = (argc>1?atoi(argv[1]):100);
     int sizes = (argc>2?atoi(argv[2]):10);
-    unsigned long seed = (argc>3?atoi(argv[3]):BaseTimer::seed ());
+    unsigned long seed = (unsigned long)(argc>3?(unsigned long)atoi(argv[3]):(unsigned long)BaseTimer::seed ());
     int failures = 0;
 //     std::cerr << "Seed: " << seed << std::endl;
     Integer::seeding (seed);
diff --git a/tests/test-random.C b/tests/test-random.C
index d356399..dc2de57 100644
--- a/tests/test-random.C
+++ b/tests/test-random.C
@@ -31,6 +31,7 @@ int test1()
 
 	Integer un(26);
 	Integer autre(511);
+	Integer large( Integer::one<<3000);
 #ifdef GIVARO_DEBUG
 	cout << "random...............OK" << endl;
 #endif
@@ -48,6 +49,7 @@ int test1()
 
 	unsigned long trois = 3 ;
 	unsigned long petits = 6 ;
+	unsigned long grands = 300 ;
 	//std::vector<int> T(1<<petits) ;
 
 	for (size_t i = 0 ; i < 5000 ; ++i) {
@@ -89,6 +91,30 @@ int test1()
 #endif
 
 	for (size_t i = 0 ; i < 5000 ; ++i) {
+		Integer tata = toto.random_lessthan_2exp(grands);
+		if ( tata.bitsize() > grands ) {
+			//        cout << tata << endl;
+			cout << "random_lessthan_2exp  failed" << endl;
+			return -1  ;
+		}
+	}
+#ifdef GIVARO_DEBUG
+	cout << "random_lessthan_2exp.....OK" << endl;
+#endif
+
+	for (size_t i = 0 ; i < 5000 ; ++i) {
+		Integer tata = toto.random_lessthan(large);
+		//        cout << tata << endl;
+		if ( tata.bitsize() > large.bitsize() ){
+			cout << "random_lessthan  failed" << endl;
+			return -1  ;
+		}
+	}
+#ifdef GIVARO_DEBUG
+	cout << "random_lessthan.........OK" << endl;
+#endif
+
+	for (size_t i = 0 ; i < 5000 ; ++i) {
 		Integer tata = toto.nonzerorandom(petits);
 		if (tata == 0 || tata >= 1<<petits) {
 			//        cout << tata << endl;
@@ -116,7 +142,7 @@ int test1()
 
 }/*}}}*/
 
-//! tests <code>ret= ::func(arg,arg);</code>
+//! tests \verbatim ret= ::func(arg,arg); \endverbatim
 int test2()
 {/*{{{*/
 	Integer un(26);
@@ -203,7 +229,7 @@ int test2()
 
 }/*}}}*/
 
-//! tests <code>::func(ret,arg,arg);</code>
+//! tests \verbatim ::func(ret,arg,arg); \endverbatim
 int test3()
 {/*{{{*/
 	Integer un(26);
diff --git a/tests/test-ratrecon.C b/tests/test-ratrecon.C
index 9c5fdde..e0360ea 100644
--- a/tests/test-ratrecon.C
+++ b/tests/test-ratrecon.C
@@ -97,8 +97,8 @@ int main(int argc, char ** argv)
 #ifdef GIVARO_DEBUG
     std::cerr << "seed: " << seed << std::endl;
 #endif
-    Integer::seeding(seed);
-    GivRandom generator(seed);
+    Integer::seeding((unsigned long)seed);
+    GivRandom generator((unsigned long)seed);
 
     typedef ZpzDom<Std64> Field;
     typedef Poly1Dom< Field, Dense > PolyZpz;
diff --git a/tests/test-ringarith.C b/tests/test-ringarith.C
index 94de5bc..2c474a6 100644
--- a/tests/test-ringarith.C
+++ b/tests/test-ringarith.C
@@ -50,7 +50,8 @@ if (TestOneRing(F,a,x)) {\
 
 template<class R, class T1, class T2>
 struct InitOrAssign {
-    void operator()(const R& r, T1& t1, const T2& t2) {
+    void operator()(const R& r, T1& t1, const T2& t2)
+    {
         r.init(t1,t2);
     }
 };
@@ -68,7 +69,7 @@ struct InitOrAssign<R,T,T> {
 
 template<class Ring, class T1, class T2>
 int TestOneRing(const Ring& F, const T1 FIRSTINT, const T2 FIRSTFLOAT)
-{/*{{{*/
+{
 #ifdef GIVARO_DEBUG
 	std::cerr << "testing " ;
 	F.write(std::cerr );
@@ -170,16 +171,16 @@ int TestOneRing(const Ring& F, const T1 FIRSTINT, const T2 FIRSTFLOAT)
 #endif
 	return 0 ;
 
-}/*}}}*/
+}
 
 #define NBITER 50
 
 template<class Ring>
-int TestRing(const Ring& F, const int seed)
-{/*{{{*/
-    long ch = F.characteristic();
+int TestRing(const Ring& F, const unsigned  long seed)
+{
+    long ch = (long) F.characteristic();
     JEONETESTE(F,7UL,-29.3);
-    srand48(seed);
+    srand48((long)seed);
     for(size_t i=0; i< NBITER; ++i) {
         typename Ring::Element x;
         float d;
@@ -193,38 +194,64 @@ int TestRing(const Ring& F, const int seed)
         JEONETESTE(F,x,d);
     }
     return 0;
-}/*}}}*/
+}
 
+#ifndef DEGMAX
 #define DEGMAX 75
+#endif
+#ifndef NBITERD
 #define NBITERD 10
+#endif
 
 template<class Ring>
-int TestPolRing(const Ring& F, const int seed)
-{/*{{{*/
+int TestPolRing(const Ring& F, const unsigned long seed)
+{
     GivRandom generator(seed);
-    srand48(seed);
+    srand48((long)seed);
 
     for(size_t i=0; i< NBITERD; ++i) {
         int d1 = int (lrand48() % DEGMAX);
         int d2 = int (lrand48() % DEGMAX);
-#ifdef GIVARO_DEBUG
-        std::cout << d1 << ' ' << d2 << ' ';
-#endif
-        typename Ring::Element x, d;
+        typename Ring::Element x, d, z, o;
         do {
             F.random(generator, x, Degree(d1));
         } while(F.isZero(x));
         do {
             F.random(generator, d, Degree(d2));
-        } while(F.isZero(x));
+        } while(F.isZero(d));
+#ifdef GIVARO_DEBUG
+        std::cout << d1 << ' ' << d2 << ' ';
+#endif
         JEONETESTE(F,x,d);
+        do {
+            F.random(generator, z, Degree(0));
+        } while(F.isZero(z));
+#ifdef GIVARO_DEBUG
+        std::cout << d1 << " 0 ";
+#endif
+        JEONETESTE(F,x,z);
+#ifdef GIVARO_DEBUG
+        std::cout << "0 " << d1 << ' ';
+#endif
+        JEONETESTE(F,z,x);
+        do {
+            F.random(generator, o, Degree(1));
+        } while(F.isZero(o));
+#ifdef GIVARO_DEBUG
+        std::cout << d2 << " 1 ";
+#endif
+        JEONETESTE(F,d,o);
+#ifdef GIVARO_DEBUG
+        std::cout << "1 " << d2 << ' ';
+#endif
+        JEONETESTE(F,o,d);
     }
     return 0;
-}/*}}}*/
+}
 
 int main(int argc, char ** argv)
-{/*{{{*/
-    int seed = int(argc>1?atoi(argv[1]):BaseTimer::seed());
+{
+    unsigned long seed = (unsigned long) (argc>1?atoi(argv[1]):BaseTimer::seed());
 #ifdef GIVARO_DEBUG
     std::cerr << "seed: " << seed << std::endl;
 #endif
@@ -371,7 +398,7 @@ int main(int argc, char ** argv)
 #endif
 
 	return 0;
-}/*}}}*/
+}
 
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
diff --git a/tests/test-trunc.C b/tests/test-trunc.C
index f610649..caf3e61 100644
--- a/tests/test-trunc.C
+++ b/tests/test-trunc.C
@@ -19,20 +19,20 @@ bool TestAdd(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.add ( R, P, Q, d1, d2); // R = P+Q;
+    DP.add ( R, P, Q, (long)d1, (long)d2); // R = P+Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.add (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = P; U = P;
-    DP.addin(S,Q,d1,d2);
+    DP.addin(S,Q,(long)d1,(long)d2);
     DP.addin(U,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         std::cerr << "ERROR ADD:" << TTcount << std::endl;
@@ -53,20 +53,20 @@ bool TestSub(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.sub ( R, P, Q, d1, d2); // R = P-Q;
+    DP.sub ( R, P, Q, (long)d1, (long)d2); // R = P-Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.sub (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = P; U = P;
-    DP.subin(S,Q,d1,d2);
+    DP.subin(S,Q,(long)d1,(long)d2);
     DP.subin(U,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         std::cerr << "ERROR SUB:" << TTcount << std::endl;
@@ -87,20 +87,20 @@ bool TestMul(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::E
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.mul ( R, P, Q, d1, d2); // R = P*Q;
+    DP.mul ( R, P, Q, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.mul (T, P, Q);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = P; U = P;
-    DP.mulin(S,Q,d1,d2);
+    DP.mulin(S,Q,(long)d1,(long)d2);
     DP.mulin(U,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         std::cerr << "ERROR MUL:" << TTcount << std::endl;
@@ -121,20 +121,20 @@ bool TestAxpy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.axpy ( R, P, Q, G, d1, d2); // R = P*Q+G;
+    DP.axpy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q+G;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") * (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.axpy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = G; U = G;
-    DP.axpyin(S,P,Q,d1,d2);
+    DP.axpyin(S,P,Q,(long)d1,(long)d2);
     DP.axpyin(U,P,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         DP.write(std::cerr << "ERROR Axpy: ") << std::endl;
@@ -165,20 +165,20 @@ bool TestAxmy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >::
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.axmy ( R, P, Q, G, d1, d2); // R = P*Q-G;
+    DP.axmy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q-G;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.axmy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = G; U = G;
-    DP.axmyin(S,P,Q,d1,d2);
+    DP.axmyin(S,P,Q,(long)d1,(long)d2);
     DP.axmyin(U,P,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R) || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         std::cerr << "ERROR Axmy:" << std::endl;
@@ -207,20 +207,20 @@ bool TestMaxpy(const TruncDom< GFqDom<int> >& DP, const TruncDom< GFqDom<int> >:
 {
     ++TTcount;
     TruncDom< GFqDom<int> >::Element R, T, V, S, U, W;
-    DP.maxpy ( R, P, Q, G, d1, d2); // R = P*Q;
+    DP.maxpy ( R, P, Q, G, (long)d1, (long)d2); // R = P*Q;
 //     DP.write( DP.write(
 //         std::cout << "[(" , P ) << ") + (", Q) << ")]_" << d1 << '^' << d2 ;
 //     DP.write(std::cout << " = " , R) << std::endl;
 
     DP.maxpy (T, P, Q, G);
     V=T;
-    DP.truncin(V,d1,d2);
+    DP.truncin(V,(long)d1,(long)d2);
 
     S = G; U = G;
-    DP.maxpyin(S,P,Q,d1,d2);
+    DP.maxpyin(S,P,Q,(long)d1,(long)d2);
     DP.maxpyin(U,P,Q);
     W=U;
-    DP.truncin(W,d1,d2);
+    DP.truncin(W,(long)d1,(long)d2);
 
     if( DP.areNEqual( V, R)  || DP.areNEqual(W, S) || DP.areNEqual(V, W) ) {
         std::cerr << "ERROR Maxpy:" << std::endl;
@@ -379,14 +379,14 @@ int main(int argc, char ** argv) {
     success &= TestMaxpy(DP101, P,Q,R, 1, 2);
 
 
-    GivRandom generator(seed);
+    GivRandom generator((unsigned long)seed);
 
     for(size_t i=0; i<100; ++i) {
-        long deg1 = generator() % 75;
-        long deg2 = generator() % 85;
-        long deg3 = generator() % 155;
-        long v1 = generator() % 195;
-        long v2 = v1 + (generator() % 5);
+        long deg1 = (long)generator() % 75;
+        long deg2 = (long)generator() % 85;
+        long deg3 = (long)generator() % 155;
+        long v1 = (long)generator() % 195;
+        long v2 = v1 + (long)(generator() % 5);
         DP101.random(generator, P, Degree(deg1) );
         DP101.random(generator, Q, Degree(deg2) );
         DP101.random(generator, R, Degree(deg3) );
@@ -396,12 +396,12 @@ int main(int argc, char ** argv) {
         Degree vP; DP101.val(vP,P);
         Degree vQ; DP101.val(vQ,Q);
         Degree vR; DP101.val(vR,R);
-        success &= TestAdd(DP101, P, Q, v1, v2 );
-        success &= TestSub(DP101, P, Q, v1, v2 );
-        success &= TestMul(DP101, P, Q, v1, v2 );
-        success &= TestAxpy(DP101, P, Q, R, v1, v2 );
-        success &= TestAxmy(DP101, P, Q, R, v1, v2 );
-        success &= TestMaxpy(DP101, P, Q, R, v1, v2 );
+        success &= TestAdd(DP101, P, Q, (size_t)v1, (size_t)v2 );
+        success &= TestSub(DP101, P, Q, (size_t)v1, (size_t)v2 );
+        success &= TestMul(DP101, P, Q, (size_t)v1, (size_t)v2 );
+        success &= TestAxpy(DP101, P, Q, R, (size_t)v1, (size_t)v2 );
+        success &= TestAxmy(DP101, P, Q, R, (size_t)v1, (size_t)v2 );
+        success &= TestMaxpy(DP101, P, Q, R, (size_t)v1, (size_t)v2 );
     }
 
     success &= TestAxpy(DP101, P, Q, monomial, 11, 11);

-- 
givaro: library for arithmetic and algebraic computations



More information about the debian-science-commits mailing list